test: add more test cases for pathToFileURL#63293
Open
RafaelGSS wants to merge 1 commit into
Open
Conversation
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
4069b78 to
875c813
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63293 +/- ##
==========================================
- Coverage 90.05% 90.03% -0.02%
==========================================
Files 714 714
Lines 225247 225247
Branches 42578 42573 -5
==========================================
- Hits 202842 202804 -38
- Misses 14181 14229 +48
+ Partials 8224 8214 -10 🚀 New features to boost your workflow:
|
aduh95
reviewed
May 14, 2026
Comment on lines
+25
to
+35
| 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 | ||
| ]; |
Contributor
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:
Suggested change
| 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 | |
| ]; | |
| const forbiddenHostnameChars = 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
Contributor
There was a problem hiding this comment.
I've opened ada-url/ada#1142 to address the # and ? cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Just to make sure we won't introduce any regression anytime further (based on H1 reports we received).