Skip to content

Commit 18c0e3d

Browse files
committed
review feedback
1 parent 54f412f commit 18c0e3d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/nextjs/src/config/manifest/createRouteManifest.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ function buildRegexForDynamicRoute(routePath: string): { regex: string; paramNam
7777

7878
let pattern: string;
7979
if (hasOptionalCatchall) {
80-
if (regexSegments.length == 0) {
80+
if (regexSegments.length === 0) {
8181
// If the optional catchall happens at the root, accept any path starting
82-
// with a slash.
83-
pattern = '^/.*$';
82+
// with a slash. Need capturing group for parameter extraction.
83+
pattern = '^/(.*)$';
8484
} else {
8585
// For optional catchall, make the trailing slash and segments optional
8686
// This allows matching both /catchall and /catchall/anything

packages/nextjs/test/config/manifest/suites/catchall-at-root/catchall-at-root.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('catchall', () => {
1111
dynamicRoutes: [
1212
{
1313
path: '/:path*?',
14-
regex: '^/.*$',
14+
regex: '^/(.*)$',
1515
paramNames: ['path'],
1616
},
1717
],

0 commit comments

Comments
 (0)