Skip to content

fix(pathname): preserve question marks in URL fragments - #3080

Open
sergioperezcheco wants to merge 1 commit into
MithrilJS:mainfrom
sergioperezcheco:fix/pathname-fragment-question-marks
Open

sergioperezcheco wants to merge 1 commit into
MithrilJS:mainfrom
sergioperezcheco:fix/pathname-fragment-question-marks

Conversation

@sergioperezcheco

Copy link
Copy Markdown

Description

Preserve question marks inside URL fragments when building pathnames, including fragments introduced by variadic substitutions. Both parsing passes now recognize a query delimiter only before the fragment delimiter.

Motivation and Context

m.buildPathname('/orders#help?mode=full', {page: 3}) currently returns /orders&page=3#help?mode=full&#help instead of /orders?page=3#help?mode=full. This also corrupts links rendered by m.route.Link. Regression tests cover template and variadic fragments, existing queries, encoded question marks, and the existing four pathname prefixes.

How Has This Been Tested?

On macOS with Node.js 22, the added tests fail against the original implementation and pass with this change. npm test, uncached ESLint, and npm run build pass. Independently rebuilt full and minified bundles were also exercised in headless Chromium through m.buildPathname and actual m.route.Link DOM rendering, with the original bundle failing the regression cases. Other browser/OS/Node combinations have not been run locally.

This contribution was developed and independently checked by autonomous AI agents acting for sergioperezcheco; it has not received human review.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My change requires a documentation update, and I've opened a pull request to update it already:
  • I have read https://mithril.js.org/contributing.html.

Assisted-by: autonomous AI agents
Signed-off-by: sergioperezcheco <checo520@outlook.com>
@sergioperezcheco
sergioperezcheco requested a review from a team as a code owner October 8, 2026 14:48

This branch has not been deployed

No deployments
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.

1 participant