diff --git a/packages/next/build/utils.ts b/packages/next/build/utils.ts index 2bb641ed5c7e9..3c68b3d548592 100644 --- a/packages/next/build/utils.ts +++ b/packages/next/build/utils.ts @@ -592,11 +592,9 @@ export async function isPageStatic( builtPage = builtPage.replace( `[${repeat ? '...' : ''}${validParamKey}]`, - encodeURIComponent( - repeat - ? (paramValue as string[]).join('/') - : (paramValue as string) - ) + repeat + ? (paramValue as string[]).map(encodeURIComponent).join('/') + : encodeURIComponent(paramValue as string) ) }) diff --git a/test/integration/prerender/test/index.test.js b/test/integration/prerender/test/index.test.js index a6ff7e056ba68..a6a6fc5ec63e4 100644 --- a/test/integration/prerender/test/index.test.js +++ b/test/integration/prerender/test/index.test.js @@ -109,8 +109,8 @@ const expectedManifestRoutes = () => ({ initialRevalidateSeconds: false, srcRoute: null, }, - '/catchall/another%2Fvalue': { - dataRoute: `/_next/data/${buildId}/catchall/another%2Fvalue.json`, + '/catchall/another/value': { + dataRoute: `/_next/data/${buildId}/catchall/another/value.json`, initialRevalidateSeconds: 1, srcRoute: '/catchall/[...slug]', },