From 050a720b0732fcc15b8da8767e63b5110dcbfbbb Mon Sep 17 00:00:00 2001 From: Xavier Coppens Date: Sun, 17 Nov 2024 16:09:51 +0000 Subject: [PATCH] Fixed interception on a catchAll route --- .../next/src/lib/generate-interception-routes-rewrites.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/next/src/lib/generate-interception-routes-rewrites.ts b/packages/next/src/lib/generate-interception-routes-rewrites.ts index ee1458fabb319..0415f78b7a425 100644 --- a/packages/next/src/lib/generate-interception-routes-rewrites.ts +++ b/packages/next/src/lib/generate-interception-routes-rewrites.ts @@ -13,8 +13,8 @@ function toPathToRegexpPath(path: string): string { const paramName = capture.replace(/\W+/g, '_') // handle catch-all segments (e.g. /foo/bar/[...baz] or /foo/bar/[[...baz]]) - if (paramName.startsWith('...')) { - return `:${paramName.slice(3)}*` + if (capture.startsWith('...')) { + return `:${capture.slice(3)}*` } return ':' + paramName })