Skip to content

fix(trie-router): match suffix wildcard routes - #5220

Closed
lazerg wants to merge 1 commit into
honojs:mainfrom
lazerg:fix/trie-router-suffix-wildcard
Closed

lazerg wants to merge 1 commit into
honojs:mainfrom
lazerg:fix/trie-router-suffix-wildcard

Conversation

@lazerg

@lazerg lazerg commented Aug 12, 2026

Copy link
Copy Markdown

TrieRouter stores a label like assets* as a plain literal child, so /assets* never matched anything. RegExpRouter, LinearRouter and PatternRouter all handle it. The gap only shows up once RegExpRouter throws UnsupportedPathError and SmartRouter falls back to the trie, which is what the report in the issue hits.

Node#insert now records a label ending in * as a prefix on the parent node, and Node#search pushes that node's handlers when the current path part starts with the prefix.

Fixes #5219

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

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.

Suffix wildcard routes (/foo*) return 404 when a sub-app has static + :param routes with the same method

2 participants