Only skip trailing-slash removal for drive letters on file: URLs#1138
Open
momomuchu wants to merge 1 commit into
Open
Only skip trailing-slash removal for drive letters on file: URLs#1138momomuchu wants to merge 1 commit into
momomuchu wants to merge 1 commit into
Conversation
last_slash_can_be_removed() refused to drop a trailing slash whenever
the previous path segment looked like a Windows drive letter (C: or
C|), even outside file: URLs. Per the URL spec this exemption only
applies to file: URLs, matching its siblings shorten_path and
pop_path which already gate on scheme_type.is_file(). Add the same
guard so join("..") pops an ordinary segment such as "C:" for any
other scheme.
Fixes servo#1130
eac9a75 to
f071a35
Compare
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.
last_slash_can_be_removed() refused to drop a trailing slash whenever the
previous path segment looked like a Windows drive letter (C: or C|), even
outside file: URLs. Per the spec (https://url.spec.whatwg.org/#pop-a-urls-path)
this exemption only applies when url's scheme is "file" - shorten_path and
pop_path already gate the same check on scheme_type.is_file(), this was the
one sibling that didn't.
Fixes #1130
Added tests cover non-file special and non-special schemes, the C| form,
and a companion case confirming file: URLs keep the existing drive-letter
guard.