You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
named catch-all routes ([...name]) don't match the base path #4808
A named catch-all route like routes/test/[...path].ts matches /test/a/b but not /test or /test/. The unnamed form routes/test/[...].ts does match /test, so the two behave differently.
File
Route
/test
/test/a/b
routes/test/[...].ts
/test/**
matches
matches
routes/test/[...path].ts
/test/**:path
no match
matches (path: "a/b")
This is expected rou3 behavior: in rou3 1.0, **:name means one or more segments, while ** means zero or more. The difference comes from how src/scan.ts maps [...name] to **:name. The current workaround is adding routes/test/index.ts that re-exports the catch-all handler.
A possible fix is mapping [...name] to :name(.*) instead, which matches /test (no name), /test/ (name: "") and /test/a/b (name: "a/b"). This would change matching for existing apps, so it fits v3.
Reproduced against rou3 1.0 directly: /test/:path matches /test/a/b but neither /test nor /test/, while /test/ matches all three - so the v3 regression from #1242 is exactly the one-or-more vs zero-or-more split you describe.
Fix direction: in src/scan.ts map the named catch-all [...name] to the zero-or-more named form :name(.) instead of **:name. Verified locally that /test/:path(.) matches /test (no param), /test/ (path ""), and /test/a/b (path "a/b"), so handlers see the same shape as the unnamed form.
Activity
charan-rathore commentedon Oct 17, 2026
Reproduced against rou3 1.0 directly: /test/:path matches /test/a/b but neither /test nor /test/, while /test/ matches all three - so the v3 regression from #1242 is exactly the one-or-more vs zero-or-more split you describe.
Fix direction: in src/scan.ts map the named catch-all [...name] to the zero-or-more named form :name(.) instead of **:name. Verified locally that /test/:path(.) matches /test (no param), /test/ (path ""), and /test/a/b (path "a/b"), so handlers see the same shape as the unnamed form.
I'd like to take this one - ok to open the PR?