Repository navigation
keep query and fragment delimiter in canonicalize search and hash - #1171
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (12.50%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1171 +/- ##
==========================================
- Coverage 59.87% 59.79% -0.09%
==========================================
Files 37 37
Lines 6121 6121
Branches 2974 2978 +4
==========================================
- Hits 3665 3660 -5
- Misses 617 618 +1
- Partials 1839 1843 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
anonrig
approved these changes
Jul 9, 2026
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.
canonicalize_search and canonicalize_hash strip a leading "?"/"#", but per the URLPattern spec that single delimiter is removed by process a search / process a hash, while these encoders run the URL parser in query state / fragment state where "?" and "#" are ordinary code points. The extra strip drops an escaped literal, so URLPattern({search: "\?x"}) compiles a pattern that matches a search of "x" instead of "?x", and canonicalize_search("?x") returns "x" rather than "?x". The effect was hidden for base-URL inheritance because url_pattern_init::process passed get_search()/get_hash() with their delimiters straight into process a base URL string, so the two strips cancelled. This drops the strip from both encoders and feeds the raw query/fragment (leading delimiter removed) when inheriting from a base URL, matching the spec's "baseURL's query" / "baseURL's fragment". Added a regression test; the full WPT urlpattern suite stays green.