Skip to content

fix: reject empty middle wildcard segments - #5522

Open
mikamikasuki wants to merge 1 commit into
honojs:mainfrom
mikamikasuki:fix/middle-wildcard-empty-segment
Open

mikamikasuki wants to merge 1 commit into
honojs:mainfrom
mikamikasuki:fix/middle-wildcard-empty-segment

Conversation

@mikamikasuki

Copy link
Copy Markdown

Summary

Keep TrieRouter and LinearRouter consistent with RegExpRouter and PatternRouter for middle wildcards. A route such as /a/*/b should require a non-empty segment, but currently matches /a//b in TrieRouter and LinearRouter.

This change rejects empty middle wildcard segments and preserves trailing wildcard behavior.

Validation

  • pnpm run build
  • pnpm run check (0 errors; existing warnings)
  • env -u NO_COLOR FORCE_COLOR=1 pnpm run test (5,208 passed, 44 skipped)
  • The shared router regression failed before the fix in TrieRouter and LinearRouter, then passed for all four routers.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • pnpm run check:fix to format and lint 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.

1 participant