Repository navigation
🐛 fix(url): read special links without slashes - #2295
Merged
gaborbernat merged 2 commits intoNov 16, 2026
Merged
Conversation
resolve_links() and the document base returned a link whose special scheme differed from the base's as written when it had no slash or a single slash before the host, and returned a backslash in its path unchanged. A browser reads the host after any run of slashes that follows the scheme and treats a backslash as a path separator in a special URL. The link join now does the same, resolving the path segments, including %2e dot segments, the same way for every special scheme except file. A reference that shares the base's scheme and has no authority stays relative. Fixes tox-dev#2277.
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.
Node.resolve_links()returned a link whose special scheme differs from the base's as written when the link had no slash or one slash before its host, and returned a backslash in its path unchanged, softp:elsewhere.test/xandx\ydid not resolve to the URL a browser opens (#2277). Fixes #2277. 🔗 Once this merges, such links resolve to the host and path a browser reads.The link join read a special scheme's host only for an empty authority, and it took a backslash as a path character. The WHATWG URL parser reads the host after any run of slashes that follows a special scheme, zero or more of them (special authority slashes state, special authority ignore slashes state). It treats a backslash as a path separator in every special URL (special scheme), and it treats
%2ein any case as a single-dot path segment (single-dot path segment).The join now reads the host after those slashes for every special scheme except
file, and merges the path with the same separator and dot-segment rules for every special base. The fast path that skips the join for absolute links sends a link through the join when the join would change it, such as a link with no slash before the host, a backslash, or an upper-case scheme. A reference that shares the base's scheme and has no authority stays relative.Behavior changes
%2eand%2e%2ein any case are dot segments in relative paths and in those rewritten links.ftp:/, stays as written.ftp:h:21/pkeeps:21.filescheme keep the RFC 3986 reading.