fix(cli): #1713 decode url-encoded dynamic route params from getparamsfromsegment#1714
Open
jstockdi wants to merge 1 commit into
Open
Conversation
…ms from getparamsfromsegment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Resolves #1713
Documentation
N/A — no user-facing documentation change. This restores the already-documented behavior that dynamic route params round-trip losslessly from
getStaticPathstogetBody/getStaticParams.Summary of Changes
getParamsFromSegment(packages/cli/src/lib/url-utils.js) nowdecodeURIComponents eachURLPatterngroup value, mirroring the decode already applied to ids/labels/titles inlifecycles/graph.js. Decoding is guarded with try/catch so a malformed value falls back to its raw form, andundefinedcatch-all group values are passed through untouched.café,hello world) reachgetBodydecoded, and fixes theexecute-route-module.jsparam comparison (both sides are now decoded), sogetStaticParamspages no longer crash the build.packages/cli/test/cases/build.default.dynamic-params-encoded/: a[slug].jswhosegetStaticPathsreturnscaféand whosegetBodyechoesparams.slug; asserts the built page contains the decodedcafé, notcaf%C3%A9. Verified failing on unpatched source and passing with the fix.getStaticPathsparams). Existing dynamic-routing / getStaticPaths / SSR / API-route specs continue to pass.