-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.
Description
Version
v16.10.0
Platform
No response
Subsystem
No response
What steps will reproduce the bug?
// test.mjs
import './foo%2cbar.mjs';
or
// test2.mjs
await import('./foo%2cbar.mjs');
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.
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.