Skip to content

Conversation

@kfule
Copy link
Contributor

@kfule kfule commented Jan 17, 2026

Description

This PR reverts the router’s initial decoding strategy during route path resolution to behavior similar to v2.3.7 and earlier.

#3050 fixed a decoder bug. However, because the decoder is now applied more aggressively than before, it appears to have had an unintended effect on path-segment parsing.

Additionally, since decodeURIComponent was being used directly within compileTemplate(), this PR changed it to use decodeURIComponentSafe instead.

Motivation and Context

fixes #3064

How Has This Been Tested?

npm run test
Additionally, I confirmed improved behavior in the following flems.

// fallback
const def = {view: () => "default"}

const abc = {
  view: ({attrs}) => [
    m("div", "a: " + attrs.a),
    m("div", "b: " + attrs.b),
    m("div", "c: " + attrs.c)
  ]
}

m.route(document.body, "/", {
  "/": def,
  "/a/:a/b/:b/:c...": abc
})

// m.route.set("/a/foo/b/bar/baz")
m.route.set("/a/fo%3Fo/b/bar/baz") // ?
// m.route.set("/a/fo%23o/b/bar/baz") // #
// m.route.set("/a/fo%2Fo/b/bar/baz") // /
// m.route.set("/a/fo%E0%80%80o/b/bar/baz") // malformed URI sequence

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.

@kfule kfule requested a review from a team as a code owner January 17, 2026 08:50
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.

Regression in 2.3.8: routes that contain an escaped question mark silently fail

1 participant