1203b9082b
This ensures we handle encoding/decoding for SSG prerendered/fallback pages correctly. Since we only encode path delimiters when outputting to the disk we need to match this encoding when building the `ssgCacheKey` to look-up the prerendered pages. This also fixes non-ascii prerendered paths (e.g. 商業日語) not matching correctly. This does not resolve 👉 https://github.com/vercel/next.js/issues/10084 and further investigation will be needed before addressing non-ascii paths for non-SSG pages. The encoding output was tested against https://tst-encoding-l7amu5b9c.vercel.app/ to ensure the values will match correctly on Vercel. Closes: https://github.com/vercel/next.js/issues/17582 Closes: https://github.com/vercel/next.js/issues/17642 x-ref: https://github.com/vercel/next.js/pull/14717
22 lines
819 B
JavaScript
22 lines
819 B
JavaScript
export default function getPaths(pathPrefix) {
|
|
return [
|
|
// this will get turned into %2Fmy-post%2F
|
|
{ params: { slug: '/my-post/' } },
|
|
// this will get turned into %252Fmy-post%252F
|
|
{ params: { slug: '%2Fmy-post%2F' } },
|
|
// this will be passed through
|
|
{ params: { slug: '+my-post+' } },
|
|
// this will get turned into %3Fmy-post%3F
|
|
{ params: { slug: '?my-post?' } },
|
|
// ampersand signs
|
|
{ params: { slug: '&my-post&' } },
|
|
// non-ascii characters
|
|
{ params: { slug: '商業日語' } },
|
|
{ params: { slug: ' my-post ' } },
|
|
{ params: { slug: encodeURIComponent('商業日語') } },
|
|
`${pathPrefix}/%2Fsecond-post%2F`,
|
|
`${pathPrefix}/%2Bsecond-post%2B`,
|
|
`${pathPrefix}/%26second-post%26`,
|
|
`${pathPrefix}/mixed-${encodeURIComponent('商業日語')}`,
|
|
]
|
|
}
|