Uh oh!
There was an error while loading. Please reload this page.
test: add more test cases for pathToFileURL - #63293
Conversation
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
4069b78 to
875c813CompareCodecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #63293 +/- ##
==========================================
+ Coverage 90.05% 90.30% +0.24%
==========================================
Files 714 730 +16 Lines 225247 234773 +9526 Branches 42578 43955 +1377 ==========================================
+ Hits 202842 212001 +9159 - Misses 14181 14485 +304 - Partials 8224 8287 +63 🚀 New features to boost your workflow:
|
| const forbiddenHostnameChars = [ | ||
| '\\\\exa mple\\share\\file.txt', | ||
| '\\\\host name\\share\\file.txt', // space | ||
| '\\\\host#name\\share\\file.txt', // hash | ||
| '\\\\host?name\\share\\file.txt', // question mark | ||
| '\\\\host@name\\share\\file.txt', // at sign | ||
| '\\\\host:name\\share\\file.txt', // colon | ||
| '\\\\host/name\\share\\file.txt', // forward slash | ||
| '\\\\host[name\\share\\file.txt', // left bracket | ||
| '\\\\host]name\\share\\file.txt', // right bracket | ||
| ]; |
There was a problem hiding this comment.
According to https://url.spec.whatwg.org/#host-miscellaneous, there are a few more forbidden char we might as well check for:
| constforbiddenHostnameChars=[ | |
| '\\\\exa mple\\share\\file.txt', | |
| '\\\\host name\\share\\file.txt',// space | |
| '\\\\host#name\\share\\file.txt',// hash | |
| '\\\\host?name\\share\\file.txt',// question mark | |
| '\\\\host@name\\share\\file.txt',// at sign | |
| '\\\\host:name\\share\\file.txt',// colon | |
| '\\\\host/name\\share\\file.txt',// forward slash | |
| '\\\\host[name\\share\\file.txt',// left bracket | |
| '\\\\host]name\\share\\file.txt',// right bracket | |
| ]; | |
| constforbiddenHostnameChars=Array.from('\0\t\n\r #:<>?@[]^|',(sep)=>`\\\\host${sep}name\\share\\file.txt`); |
But it looks like \n, \r, \t are ignored instead of being rejected; # and ? might have a special significant in UNC not sure
There was a problem hiding this comment.
I've opened ada-url/ada#1142 to address the # and ? cases
There was a problem hiding this comment.
Ok, I will wait it to reach Node.js main, ping me please
There was a problem hiding this comment.
Sorry forgot to follow up, but the upstream issue was closed so let's limit to the ones that are supported
| constforbiddenHostnameChars=[ | |
| '\\\\exa mple\\share\\file.txt', | |
| '\\\\host name\\share\\file.txt',// space | |
| '\\\\host#name\\share\\file.txt',// hash | |
| '\\\\host?name\\share\\file.txt',// question mark | |
| '\\\\host@name\\share\\file.txt',// at sign | |
| '\\\\host:name\\share\\file.txt',// colon | |
| '\\\\host/name\\share\\file.txt',// forward slash | |
| '\\\\host[name\\share\\file.txt',// left bracket | |
| '\\\\host]name\\share\\file.txt',// right bracket | |
| ]; | |
| constforbiddenHostnameChars=Array.from('\0 :<>@[]^|',(sep)=>`\\\\host${sep}name\\share\\file.txt`); |
There was a problem hiding this comment.
Yes, that's why I sent 51f1a25. Honestly, it's much clearer to see that list than the approach you suggested.
There was a problem hiding this comment.
I disagree, to me it's harder to spot the one-char diff, but as long as it works it's fine
nodejs-github-bot
commented
Jun 1, 2026
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Jun 2, 2026
Landed in fd632cf |
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: #63293 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: #63293 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: #63293 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Just to make sure we won't introduce any regression anytime further (based on H1 reports we received).