Skip to content

fix: preserve array query parameters during dynamic group redirect#28698

Closed
jaydeep-pipaliya wants to merge 1 commit intocalcom:mainfrom
jaydeep-pipaliya:fix/query-params-array-serialization
Closed

fix: preserve array query parameters during dynamic group redirect#28698
jaydeep-pipaliya wants to merge 1 commit intocalcom:mainfrom
jaydeep-pipaliya:fix/query-params-array-serialization

Conversation

@jaydeep-pipaliya
Copy link
Copy Markdown

Summary

Fixes incorrect serialization of array query parameters in the dynamic group redirect logic.

Root cause: In getServerSideProps, context.query is cast to Record<string, string> and passed to new URLSearchParams(). However, Next.js query params can be string | string[] — when a key appears multiple times (e.g. ?user=john&user=doe), the value is an array. The cast loses this structure, producing user=john,doe instead of user=john&user=doe.

Fix: Iterate over context.query entries and use searchParams.append() for each value, correctly handling both single strings and arrays.

Fixes #28687

Test plan

  • Navigate to a dynamic group URL with repeated query params: /john+doe?user=john&user=doe
  • Verify the redirect preserves both params: ?user=john&user=doe
  • Verify single-value params still work correctly: ?redirect=false
  • Verify undefined values are excluded from the redirect URL

Next.js context.query values can be string | string[], but the
redirect logic cast them to Record<string, string> before passing
to URLSearchParams. This caused array params like ?user=john&user=doe
to be serialized as user=john,doe instead of preserving each value.

Iterate over query entries and use searchParams.append() to correctly
handle both single and array values.

Fixes calcom#28687
@github-actions github-actions bot added the 🐛 bug Something isn't working label Apr 1, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 1, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copy link
Copy Markdown
Member

@sahitya-chandra sahitya-chandra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closing in favor of #28688

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/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect serialization of array query parameters in redirect logic

3 participants