fix: preserve array query parameters in redirect logic#28734
Open
TheBhowmik wants to merge 7 commits intocalcom:mainfrom
Open
fix: preserve array query parameters in redirect logic#28734TheBhowmik wants to merge 7 commits intocalcom:mainfrom
TheBhowmik wants to merge 7 commits intocalcom:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/web/server/lib/[user]/getServerSideProps.ts">
<violation number="1" location="apps/web/server/lib/[user]/getServerSideProps.ts:118">
P2: Scalar empty-string query parameters are silently dropped by the new `if (value)` filter, changing redirect query semantics (e.g., `?foo=` is removed).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
Author
|
@cubic-dev-ai I have addressed this in my latest commit by explicitly checking for null and undefined. Please re-verify. |
Contributor
@TheBhowmik I have started the AI code review. It will take a few minutes to complete. |
Member
sahitya-chandra
left a comment
There was a problem hiding this comment.
Can you clean up the comments
sahitya-chandra
requested changes
Apr 4, 2026
Author
|
"Done! I've removed the comments, cleaned up the unused imports/variables, and updated the branch with the latest changes from main. Ready for another look!" |
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.
What does this PR do?
This PR fixes the incorrect serialization of array query parameters within the getServerSideProps redirect logic.
Previously, the code used an unsafe type cast (as Record<string, string>) when initializing URLSearchParams. This caused query parameters with multiple values (e.g., ?test=a&test=b) to be merged into a single string separated by a comma (e.g., ?test=a,b) during server-side redirects.
Changes:
Removed the unsafe type casting that forced arrays into strings.
Implemented a robust loop that iterates through context.query entries.
Used URLSearchParams.append() to ensure that each value in an array is preserved as an individual key-value pair in the resulting query string.
Fixes #28687
Visual Demo (For contributors especially)
Image Demo :
Before Fix (Buggy)
.../15min?test=apple,banana
After Fix (Correct)
.../15min?test=apple&test=banana
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Start the development server and navigate to a user profile page with repeated query parameters: http://localhost:3000/wow?test=apple&test=banana
Click on any event type card (e.g., "15 min meeting") to trigger the server-side redirect logic in getServerSideProps.ts.
Expected Result: The final redirected URL should preserve the ampersand separator: localhost:3000/wow/15min?test=apple&test=banana&...
Original Buggy Behavior: The URL would incorrectly squash the values into a single string: localhost:3000/wow/15min?test=apple,banana&...
Are there environment variables that should be set?
No. This is a logic fix for standard URL serialization.
What are the minimal test data to have?
A local user profile (e.g., /wow) and at least one active Event Type (e.g., "15 min meeting").
What is expected (happy path) to have (input and output)?
Input: Navigating to /[user]?test=a&test=b and clicking an event card.
Output: Redirecting to /[user]/[event]?test=a&test=b (preserving the & separator).
Any other important info that could help to test that PR
This fix replaces an unsafe type cast that was causing URLSearchParams to treat arrays as single comma-separated strings.