url.pathToFileURL generates an incorrect file URL if the cwd is a UNC path. #56262
Closed
Description
Version
18, 20, 22, 23.4.0
Platform
Microsoft Windows NT 10.0.22631.0 x64
Subsystem
No response
What steps will reproduce the bug?
PowerShell
I have a machine called strongman
.
Setup
cd \\strongman\c$\Users
node
REPL
> process.cwd() // make sure it is a UNC path
'\\\\strongman\\c$\\Users'
> url.pathToFileURL('.')
URL {
href: 'file:////strongman/c$/Users',
origin: 'null',
protocol: 'file:',
username: '',
password: '',
host: '',
hostname: '',
port: '',
pathname: '//strongman/c$/Users',
search: '',
searchParams: URLSearchParams {},
hash: ''
}
How often does it reproduce? Is there a required condition?
100% of the time.
What is the expected behavior? Why is that the expected behavior?
url.pathToFileURL('.')
should create the correct URL: file://hostname/c$/Users
.
What do you see instead?
url.pathToFileURL('.')
creates a URL of the form: file:////hostname/c$/Users
.
Activity