-
Notifications
You must be signed in to change notification settings - Fork 30k
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
fileURLToPath returns forward slashes on Windows #25265
Comments
cc @nodejs/url |
As far as I can tell, this function has never worked as documented, even in the commit that added it (eef072f):
cc @guybedford |
It doesn't look like there are any tests for this function. I can put together a PR over the next couple of days, if that seems like a good direction. |
@zenparsing thanks for reporting, that would be really great. |
I guess the main thing is that there is the concept of whether Personally I do prefer this style in cross-env app development, only doing |
It looks like this API was added without tests and this looks like a valid bug. new URL('file:///C:/path/').pathname; // Incorrect: /C:/path/
fileURLToPath('file:///C:/path/'); // Correct: C:\path\ (Windows)
new URL('file://nas/foo.txt').pathname; // Incorrect: /foo.txt
fileURLToPath('file://nas/foo.txt'); // Correct: \\nas\foo.txt (Windows) Currently the actual results on Windows are url.fileURLToPath('file:///C:/path/') // Incorrect: 'C:/path/'
url.fileURLToPath('file://nas/foo.txt') // Incorrect: '//nas/foo.txt' Other file path APIs ( |
Makes fileURLToPath use backslashes as path separator on Windows Fixes: nodejs#25265
PR-URL: #25349 Fixes: #25265 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Bartosz Sosnowski <[email protected]> Reviewed-By: John-David Dalton <[email protected]>
PR-URL: nodejs#25349 Fixes: nodejs#25265 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Bartosz Sosnowski <[email protected]> Reviewed-By: John-David Dalton <[email protected]>
PR-URL: #25349 Fixes: #25265 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Bartosz Sosnowski <[email protected]> Reviewed-By: John-David Dalton <[email protected]>
PR-URL: #25349 Fixes: #25265 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Bartosz Sosnowski <[email protected]> Reviewed-By: John-David Dalton <[email protected]>
PR-URL: #25349 Fixes: #25265 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Bartosz Sosnowski <[email protected]> Reviewed-By: John-David Dalton <[email protected]>
url.fileURLToPath
results in a path containing forward slashes instead of backslashes on Windows.The text was updated successfully, but these errors were encountered: