-
Notifications
You must be signed in to change notification settings - Fork 139
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
Needs to ignore repeated slashes in file URL #232
Comments
Repeated slashes should be arranged in not only the http scheme, but also the file scheme as well. Tests: Fixes: whatwg#232
Repeated slashes should be arranged in not only the http scheme, but also the file scheme as well. Tests: Fixes: whatwg#232
Repeated slashes should be arranged in not only the http scheme, but also the file scheme as well. Tests: Fixes: whatwg#232
It does seem that Chrome and Edge have this behavior, while Firefox and Safari (likely changed I suppose) do not. I would support changing this based on that. We'll need new tests as well. |
@annevk Thanks for your comment! Then I will try reading |
Yeah, you can do the PRs independently as you wish. We'll link them all up before landing. As for what to use as reference, google-url seems good, but testing Edge would be good too. As for what to test, switching between |
Repeated slashes should be arranged in not only the http scheme, but also the file scheme as well. Tests: Fixes: whatwg#232
Related links + The URL Standard change: whatwg/url#234 + The original bug report: whatwg/url#232
Related links + The URL Standard change: whatwg/url#234 + The original bug report: whatwg/url#232
Repeated slashes should be ignored in not only the http scheme, but also the file scheme as well. Tests: web-platform-tests/wpt#4762 Fixes: whatwg#232
Related links + The URL Standard change: whatwg/url#234 + The original bug report: whatwg/url#232
Related links + The URL Standard change: whatwg/url#234 + The original bug report: whatwg/url#232
Related links + The URL Standard change: whatwg/url#234 + The original bug report: whatwg/url#232
Related links + The URL Standard change: whatwg/url#234 + The original bug report: whatwg/url#232
I think @watilde you must be careful with this issue: also consider case with It looks likes Edge and Chrome ignores slashes after After first pass we will get: If now we try to parse href, then will get: Other test cases to try: |
@rmisev Thanks for your comment, that's a good point indeed! I will try supporting it, and potentially we need to update some logics around the file host state. I also find an another case that should ignore some slashes: So it's not only about when the base is |
I have another problem that I don't really know a good solution to. If you have |
Let me check my understanding. According to RFC3986,
So, after seeing "file:",
Here are some examples:
Please correct me if I'm wrong. |
That is correct per that RFC, but nobody really follows it closely and the compatibility constrains are likely different too. |
It looks @watilde is proposing to ignore repeating leading slashes in pathname. If we want to do that, we would also want to remove repeating leading slashes when setting |
But only ignore them when authority is empty, or just always ignoring them? I guess file systems do not allow for empty directories, so maybe that is okay? |
If we ignore repeating leading slashes in pathname on file://localhost/ (i.e., "file://localhost////////////path" is parsed as "file:///path"), I think we should ignore them even when |
Sounds reasonable to me. (It's very heard to search for "file systems that support directories without name".) |
Always trimming would also work for when you set host to the empty string through the API. (Another case we should make sure to test.) |
@annevk @yutakahirano Sorry for my late response, and that sounds what we're looking for. I will catch up now! |
Yet another sample: Currently it is serialized to: It shows what repeated leading slashes must be removed at the end of path parse (path state), when all possible
This also works for pathname setter. |
@watilde are you still interested in working on this? |
@annevk I may take more time to fix. I would appreciate if you could take a patch :) |
Closes #4762 by superseding it. URL Standard: whatwg/url#232.
Tests: web-platform-tests/wpt#5195. Closes #234 by superseding it. Fixes #232.
Note that in #278 I went with a slightly different solution than @rmisev proposes since I wanted to go with @yutakahirano's proposal of ignoring the leading slashes even when the URL contains a host. I also ended up finding an unrelated bug and fixed that too. |
Also copy file URL hosts correctly for path-absolute input. Tests: web-platform-tests/wpt#5195. Closes #234 by superseding it. Fixes #232.
Closes #4762 by superseding it. URL Standard: whatwg/url#232.
Also copy file URL hosts correctly for path-absolute input. Tests: web-platform-tests/wpt#5195. Closes #234 by superseding it. Fixes #232.
brilliant! thanks. |
Could someone explain to me the reasoning behind this decision? I believe that it was motivated by the desire to interpret I've been working on an URL parser that follows the WhatWG behaviour but separates the parsing and the normalization phases. In that light, the following cases from the web platform tests are especially confusing.
Note that Why would you make this trade-off? Is there a motivation that I am missing? Thank you, |
@alwinb did you read through this issue and the links provided? Skimming it the rationale appears to be related to existing implementations and avoiding reparsing issues. |
I did read through it, it seems to have gone from wanting to ignore slashes after I want to make a case for keeping path normalization of file URLs and other 'special' URLs the same. However, none of the browsers (or Edge?) implement the specced behaviour.
Some ideas for alternatives:
I guess 1, 4 (and 5) seem to be the more reasonable ones. Thanks, |
Hmm, okay, I guess this warrants another look then. Could you file a new issue with the above findings? And maybe add the specified behavior as a column to the table? |
I created a new issue, #405 |
Hello!
Since the file state doesn't have a way to jump to the special authority slashes state, once the code enters into the file state, repeated slashes in the beginning of a file URL(e.g.
file://///foo/bar
should befile:///foo/bar
) can't be ignored.To cover the case, it could be done by the following steps:
Resources:
What do you think?
The text was updated successfully, but these errors were encountered: