-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
url: return backslashes from fileURLToPath on Windows #25349
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
Conversation
lib/internal/url.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you think it makes anything more readable here or elsewhere, you can use path.win32.sep and/or path.posix.sep and/or path.sep. (No strong opinion from me on whether or not they should be used here. Just pointing 'em out in case you didn't know about 'em.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I have a strong opinion either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linter is complaining that there is no second argument in assert.throws() here and elsewhere. (You can run the JS linter locally with make lint-js or, I believe, vcbuild lint-js. Running make test or, I think, vcbuild test should run the linter as well.) So this instance might be:
assert.throws(() => { url.fileURLToPath(null); }, { code: 'ERR_INVALID_ARG_TYPE' });We require the second argument because changing the code of the error is considered a breaking change. So we want the test to validate the code property at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the second args. Thanks!
|
FWIW there is already a PR for this change in #25324 |
7034c68 to
a9e54a8
Compare
|
@mscdex Ah, I didn't the other PR. Feel free to use that one if the group think it's higher quality. (Although of course I think this one is better! 😉) |
guybedford
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and nice to have lots of tests here definitely.
bzoz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has better tests than my #25324, I'm going to close that other PR.
a9e54a8 to
fb44f14
Compare
| type: TypeError, | ||
| message: 'The argument \'path\' must be a string or Uint8Array without ' + | ||
| 'null bytes. Received \'c:/tmp/\\u0000test\'' | ||
| 'null bytes. Received \'c:\\\\tmp\\\\\\u0000test\'' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this test after I noticed the error.
The reason for multiple backslashes is that ERR_INVALID_ARG_VALUE calls inspect on the invalid argument value.
|
Is the failure because I force-pushed my latest update? Or something else? Thanks for your patience : ) |
I don't know, but it happens sometimes. Here's a Rebuild: https://ci.nodejs.org/job/node-test-commit-windows-fanned/23794/ |
|
Let’s see; rebuild CI: https://ci.nodejs.org/job/node-test-pull-request/19996/ |
|
https://ci.nodejs.org/job/node-test-pull-request/19965/ passed except for Windows and https://ci.nodejs.org/job/node-test-commit-windows-fanned/23794/ passed for Windows, so I think we're good as far as CI goes. (No commits have been pushed or force-pushed since those runs.) |
|
Landed in 7237eaa. |
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: 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]>
Fixes: #25265
Fixes
url.fileURLToPathto return backslash-separated paths instead of forward-separated paths on Windows. This is my first PR to the repo so any and all feedback is welcome.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes