-
Notifications
You must be signed in to change notification settings - Fork 141
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
Should 'C%3A' or 'C%7C' be interpreted as 'C:' and 'C|'? #210
Comments
What does "should" mean here? Who says they should be considered valid Windows drive letters? |
Should in the same sense that |
For instance, > var m = new url.URL('file:///c%3a/%2e/a/%2e%2e/b')
undefined
> m
URL {
href: file:///c%3a/b
protocol: file:
pathname: /c%3a/b
} |
I believe the consensus of recent work was that %2e is special (and is only decoded in special cases, itself). See #87 |
Indeed, but windows drive letters are also already special cased in the URL parsing algorithm and anyone processing the URL appropriately (by decoding any pct-encoded characters prior to using it) can end up with rather unexpected results if they are not being careful. > var m = new url.URL('file://c%3a/%2e/a/%2e%2e/b')
undefined
> m
URL {
href: file://c:/b
protocol: file:
hostname: c:
pathname: /b
}
> var m = new url.URL('file:///c%3a/%2e/a/%2e%2e/b')
undefined
> m
URL {
href: file://c:/b
protocol: file:
pathname: /c%3a/b
} I believe it at least warrants some additional consideration. |
Does Edge do this or something? If nobody does this, I'm not sure why we would. The drive letter system is already complicated enough. |
I was kind of hoping it didn't but I just checked and the results are fairly surprising... Edge does nothing with It does, however, decode
Note the decoded However,
Results in an error being thrown with the message "A security problem occurred" The security error implies that the |
I'm not sure that's worth emulating then. The only thing that would sway this for me personally is data showing such URLs are out there and content relies on them working. |
Understood! And to be certain, I'm not trying to argue that this should be handled. It's just an edge case that happened to come up while I was putting the parser through some of it's paces and I realized it wasn't covered. At the very least, knowing that it's explicitly out of scope means I don't have to write code to account for it ;-). Will close this for now and we can revisit it again later if necessary |
Let me leave this open to make sure we add tests to web-platform-tests. |
Test created, would appreciate review. |
Given the examples
new URL('file:///C%3A/a/b/c')
andnew URL('file:///C%7C/a/b/c')
, the parsed pathnames do not unescape the%3A
(:
) and%7C
(|
). Technically speaking, those should be considered valid Windows drive letters. Currently neither the Node.js, Firefox, or Chrome impls decode the %-encoded:
and|
characters.The text was updated successfully, but these errors were encountered: