fix: preserve array query parameters in dynamic group redirects#29242
Closed
jaydeep-pipaliya wants to merge 1 commit into
Closed
fix: preserve array query parameters in dynamic group redirects#29242jaydeep-pipaliya wants to merge 1 commit into
jaydeep-pipaliya wants to merge 1 commit into
Conversation
Use node:querystring encode() instead of URLSearchParams to correctly handle string[] values in context.query. URLSearchParams joins arrays with commas (user=john,doe) while encode() properly repeats the key (user=john&user=doe). Fixes calcom#28687
Contributor
|
Welcome to Cal.diy, @jaydeep-pipaliya! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
Member
|
please re-open with before and after video demo attached. |
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.
Summary
new URLSearchParams(context.query as Record<string, string>)withencode(context.query)fromnode:querystring(already imported in the file)What was wrong
context.queryin Next.js is typed asRecord<string, string | string[] | undefined>. Casting it toRecord<string, string>and passing toURLSearchParamscauses array values like?user=john&user=doeto be serialized asuser=john,doe— a single comma-joined value instead of repeated keys.Fix
node:querystring.encode()natively handlesstring | string[]values, producinguser=john&user=doefor arrays. It was already imported at line 1 but unused for this code path.Test plan
/john?user=john&user=doe) preserves both values in redirectFixes #28687