You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error importing ES module with an encoded comma in the URL #40305
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
Should import a module named "foo,bar.mjs" located in the same folder, if present, or throw an error with code ERR_MODULE_NOT_FOUND.
What do you see instead?
Throws:
TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "./foo%2cbar.mjs" must not include encoded "/" or "\" characters imported from ./test.mjs
Note that there is no encoded "/" or "\" in "./foo%2cbar.mjs", just an encoded ","!
Additional information
In my understanding, this behavior results from a bug in lib/internal/modules/esm/resolve.js, where the regular expression encodedSepRegEx incorrectly matches an encoded slash or comma ("/" or ",") instead of a slash or backslash.
Activity
targos commentedon Oct 4, 2021
Thanks for the report @fasttime. Would you like to do a PR to fix it?
fasttime commentedon Oct 4, 2021
@targos Sure. Thanks for confirming.
lib: fix regular expression to detect `/` and `\`
lib: fix regular expression to detect `/` and `\`
lib: fix regular expression to detect `/` and `\`
lib: fix regular expression to detect `/` and `\`
lib: fix regular expression to detect `/` and `\`
lib: fix regular expression to detect `/` and `\`
lib: fix regular expression to detect `/` and `\`