Skip to content
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

url.pathToFileURL generates an incorrect file URL if the cwd is a UNC path. #56262

Open
Jason3S opened this issue Dec 15, 2024 · 0 comments · May be fixed by #56302
Open

url.pathToFileURL generates an incorrect file URL if the cwd is a UNC path. #56262

Jason3S opened this issue Dec 15, 2024 · 0 comments · May be fixed by #56302
Labels
url Issues and PRs related to the legacy built-in url module. windows Issues and PRs related to the Windows platform.

Comments

@Jason3S
Copy link

Jason3S commented Dec 15, 2024

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.

Additional information

Related to #56261 and #34736

@mertcanaltin mertcanaltin added url Issues and PRs related to the legacy built-in url module. windows Issues and PRs related to the Windows platform. labels Dec 15, 2024
@aduh95 aduh95 linked a pull request Dec 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
url Issues and PRs related to the legacy built-in url module. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants