Avoid decoding prerender matcher parameters twice (#99121)
## Summary Avoid decoding route parameters a second time while selecting prerender metadata. This fixes valid percent-containing URLs returning 500, including both build-generated closed routes and runtime-generated open routes. For example, a request for `/open/docs/space%20here/with%2Fslash/fallback%25` is already normalized for manifest lookup before reaching `PrerenderManifestMatcher`. Its final parameter now contains a literal `%`. The matcher previously used `getRouteMatcher`, which tried to decode the captures again and threw even though this call only needed to determine whether the route structure matched. Test the existing, lazily constructed route regular expression directly instead. Matcher precedence, source-page filtering, and the current server parameter encoding behavior stay unchanged. This does not introduce a new manifest or adapter contract. The open fallback is requested twice to cover generation and reuse. The existing fixture uses `dynamicParams = false` and remains excluded from the Cache Components matrix, which does not support that configuration. This is an independent prerequisite for #97393: the failure reproduces without the parameter-matching API and should be fixed for existing apps too. ## Verification - Before the fix, the new closed and open catch-all requests returned 500 with a parameter-decoding error. After the fix, both return 200 and retain the existing encoded server parameter values. - The focused matcher unit suite passes all six tests. - The three encoding regressions pass with production Webpack after restacking. The API routing suite also passes all 36 tests with fresh-native production Turbopack above this prerequisite, including its existing percent-containing URL cases. - The earlier isolated verification passed package TypeScript and changed-file lint. Deployment verification remains for CI. <!-- NEXT_JS_LLM -->
Showing
Please
register
or
sign in
to comment