Unverified Commit b42be175 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Normalize optional catch-all fallback: true page params (#17551)

This makes sure to normalize the params for optional catch-all routes on Vercel since for `fallback: true` pages the `[[...paramName]]` value will be provided for the undefined/root param which needs to be normalized. 

Tests have been added in https://github.com/vercel/vercel/pull/5247 and were manually tested with the changes in this PR with https://github.com/ijjk/next-update-loader

Fixes: https://github.com/vercel/next.js/issues/17220
x-ref: https://github.com/vercel/vercel/pull/5247
parent 782b7e48
...@@ -89,7 +89,12 @@ const nextServerlessLoader: loader.Loader = function () { ...@@ -89,7 +89,12 @@ const nextServerlessLoader: loader.Loader = function () {
(!value || ( (!value || (
Array.isArray(value) && Array.isArray(value) &&
value.length === 1 && value.length === 1 &&
value[0] === 'index' ${
''
// fallback optional catch-all SSG pages have
// [[...paramName]] for the root path on Vercel
}
(value[0] === 'index' || value[0] === \`[[...\${key}]]\`)
)) ))
) { ) {
value = undefined value = undefined
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment