-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indexer: Escape special characters in storyImport regex #22545
Conversation
Also probably related #22110 |
fileName.match( | ||
new RegExp(`^${storyImport.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(\\.[^.]+)?$`) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the only significant change? the rest is more cleanup/linting?
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 1caa075. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change looks good, GPT-4 conjured up the exact same string replacement, which obviously means this is pristine quality! 💅
Most likely also fixes #25114 |
Closes #
No issue in evidence
What I did
I had a problem with using
<Meta of{...} />
inside MDX file.It always resulted in this error and I didn't know why.
Turns out the problem was the string literal inserting in the Regex as it did not escape special characters from the file path thus it could never match.
Usually paths have slashes
/
which work fine without escaping. But I had a plus sign+
in my path. A plus sign is regex modifier, thus the regex stopped working.How to test
+
somewhere in the absolute path and try to include some MDX containing<Meta of={...} />
Such as this one:
It will result in an error.
You can compare it then with the fixed version then. The error is gone.
Checklist
MIGRATION.MD
Maintainers
make sure to add the
ci:merged
orci:daily
GH label to it.["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]