Skip to content

fix: preserve array query parameters in dynamic group redirects#29242

Closed
jaydeep-pipaliya wants to merge 1 commit into
calcom:mainfrom
jaydeep-pipaliya:fix/query-param-array-serialization
Closed

fix: preserve array query parameters in dynamic group redirects#29242
jaydeep-pipaliya wants to merge 1 commit into
calcom:mainfrom
jaydeep-pipaliya:fix/query-param-array-serialization

Conversation

@jaydeep-pipaliya
Copy link
Copy Markdown

Summary

  • Fixes incorrect serialization of array query parameters during dynamic group redirects
  • Replaces new URLSearchParams(context.query as Record<string, string>) with encode(context.query) from node:querystring (already imported in the file)

What was wrong

context.query in Next.js is typed as Record<string, string | string[] | undefined>. Casting it to Record<string, string> and passing to URLSearchParams causes array values like ?user=john&user=doe to be serialized as user=john,doe — a single comma-joined value instead of repeated keys.

Fix

node:querystring.encode() natively handles string | string[] values, producing user=john&user=doe for arrays. It was already imported at line 1 but unused for this code path.

Test plan

  • URL with repeated query params (/john?user=john&user=doe) preserves both values in redirect
  • URL with single query params continues to work unchanged
  • Dynamic group redirect includes all original query parameters

Fixes #28687

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
@github-actions
Copy link
Copy Markdown
Contributor

Welcome to Cal.diy, @jaydeep-pipaliya! Thanks for opening this pull request.

A few things to keep in mind:

  • This is Cal.diy, not Cal.com. Cal.diy is a community-driven, fully open-source fork of Cal.com licensed under MIT. Your changes here will be part of Cal.diy — they will not be deployed to the Cal.com production app.
  • Please review our Contributing Guidelines if you haven't already.
  • Make sure your PR title follows the Conventional Commits format.

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added the 🐛 bug Something isn't working label Apr 30, 2026
@romitg2
Copy link
Copy Markdown
Member

romitg2 commented Apr 30, 2026

please re-open with before and after video demo attached.

@romitg2 romitg2 closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect serialization of array query parameters in redirect logic

2 participants