fix: pop drive-letter lookalike segment for non-file schemes (#2794) - #3217
Open
pasmud wants to merge 1 commit into
Open
fix: pop drive-letter lookalike segment for non-file schemes (#2794)#3217pasmud wants to merge 1 commit into
pasmud wants to merge 1 commit into
Conversation
Member
|
Thanks for your contribution. |
Contributor
|
Hi & thank you for your contribution. We were actually hoping if servo/rust-url#1138 be merged so I'd like to keep this open for a little more and take action if it won't be fixed in the upstream. |
pasmud
force-pushed
the
gaz/lightpanda-io-browser-url-fix
branch
from
August 27, 2026 09:40
50fc0cc to
61395b7
Compare
…nda-io#2794) rust-url treats a trailing 'C:'/'C|' path segment as a Windows drive letter when shortening a path with '..', for every scheme. Per the URL Standard that exemption only applies to file:. Work around it in the Rust binding (fix pending upstream in servo/rust-url#1138) so that new URL('..', 'abc://x/y/z/C:/') resolves to 'abc://x/y/z/'.
nikneym
force-pushed
the
gaz/lightpanda-io-browser-url-fix
branch
from
September 4, 2026 15:05
61395b7 to
04e2584
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.
Fixes #2794:
new URL('..', 'abc://x/y/z/C:/')must resolve toabc://x/y/z/but rust-url refuses to pop the trailingC:segment.Root cause
rust-url 2.5.8's
last_slash_can_be_removedapplies the Windows-drive-letter exemption to every scheme when shortening a path with.., but per the WHATWG URL Standard that exemption only applies tofile:. For any other scheme aC:/C|segment is ordinary and must be popped. The upstream fix (servo/rust-url#1138) is open but unmerged, so this adds an in-repo workaround.Change
src/html5ever/url.rs: newfix_drive_letter_joinhelper, called from all four join/resolve FFI entry points (url_parse_with_base,url_join,url_resolve_without_encoding,url_resolve_with_encoding). When the base path ends with a drive-letter lookalike segment (/X:/or/X|/) on a non-file scheme and the relative input starts with.., it pops that segment from the joined URL.src/browser/URL.zig: Zig test for the resolve path covering the WPT case plus the http variant, theC|form, control segments, the no-trailing-slash case, and thefile:guard.Verification
cargo test --libinsrc/html5ever: 4/4 pass (join cases, file guard, parse-with-base path, lookalike matcher).zig fmt --check src/browser/URL.zig: clean.zig build testcould not run in this sandbox: the build fetches V8 + dependencies from GitHub, which the sandbox proxy/DNS rejects (HttpConnectionClosing/TemporaryNameServerFailure). The behavior was verified end-to-end via the Rust crate tests plus a raw probe of rust-url (abc://x/y/z/C:/ + ..returns the buggyabc://x/y/z/C:/before the fix,abc://x/y/z/after).