Skip to content

percent-encode ? and # in url pattern canonicalize_pathname#1172

Open
Arawoof06 wants to merge 1 commit into
ada-url:mainfrom
Arawoof06:canonicalize-pathname-delimiters
Open

percent-encode ? and # in url pattern canonicalize_pathname#1172
Arawoof06 wants to merge 1 commit into
ada-url:mainfrom
Arawoof06:canonicalize-pathname-delimiters

Conversation

@Arawoof06

Copy link
Copy Markdown
Contributor

canonicalize_pathname concatenates the component value into a fake://fake-url... string and runs the full basic url parser, but the url pattern spec canonicalizes a pathname with the path in state override, where ? and # are ordinary path code points that percent-encode rather than starting the query or fragment. without state override a literal ? or # ended the path early, so new URLPattern({pathname: "/a\\?b"}) compiled to match /a instead of /a%3Fb, a broader match than written; leading and trailing c0-control-or-space was stripped too. route the value through set_pathname, which runs path state override, matching how canonicalize_hostname already uses set_hostname. added a regression test.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 27.27273% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.76%. Comparing base (761db09) to head (c02d740).

Files with missing lines Patch % Lines
src/url_pattern_helpers.cpp 27.27% 1 Missing and 7 partials ⚠️

❌ Your patch check has failed because the patch coverage (27.27%) 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    #1172      +/-   ##
==========================================
- Coverage   59.79%   59.76%   -0.03%     
==========================================
  Files          37       37              
  Lines        6121     6122       +1     
  Branches     2978     2979       +1     
==========================================
- Hits         3660     3659       -1     
  Misses        618      618              
- Partials     1843     1845       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anonrig anonrig requested a review from lemire July 10, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants