-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Description
While looking at #15015 (comment) I noticed that the trailing slash check in _findPath was only keying off of a forward slash and not the backslash that Windows allows.
You can repro this by simply doing the following in a directory with an index.js
require(".\\") // throws
require("./") // will find the index.jsOther places in Node account for the backslash in Windows paths so this looks like an oversight.
Update:
It looks like if it's a two dot relative path to an index.js then it does work.
require("..\\") // work
require("..\\.") // works
require("../") // works
require("../.") // worksAlso this
require("./..") // works
require(".\\..") // throwsNotes:
It looks like path.resolve handles these cases fine so it can be excluded from the problem.
path.resolve(".\\") // 'C:\\projects\\bar\\foo'
path.resolve(".\\..") // 'C:\\projects\\bar'Metadata
Metadata
Assignees
Labels
moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.