-
Notifications
You must be signed in to change notification settings - Fork 11.2k
fix: preserve original variable values in routing from query parameters #25444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Removed comments explaining query string handling and URL encoding.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/app-store/routing-forms/lib/substituteVariables.ts">
<violation number="1" location="packages/app-store/routing-forms/lib/substituteVariables.ts:44">
`isInQueryString` compares indexes from different strings, so later path variables can be misclassified as query parameters and get URL‑encoded instead of slugified, producing incorrect paths.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 1 file (reviewed changes from recent commits).
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/app-store/routing-forms/lib/substituteVariables.ts">
<violation number="1" location="packages/app-store/routing-forms/lib/substituteVariables.ts:43">
Recomputing the variable index from the original route string misclassifies repeated placeholders—query-string occurrences now inherit the path index and get slugified instead of URL-encoded.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 1 file (reviewed changes from recent commits).
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/app-store/routing-forms/lib/substituteVariables.ts">
<violation number="1" location="packages/app-store/routing-forms/lib/substituteVariables.ts:43">
Computing `variableIndex` from the mutated URL without updating the query-string index can misclassify remaining path variables as query parameters and URL-encode them instead of slugifying.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| const humanReadableString = humanReadableValues.toString(); | ||
|
|
||
| const variablePattern = `{${variable}}`; | ||
| const variableIndex = eventTypeUrl.indexOf(variablePattern); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Computing variableIndex from the mutated URL without updating the query-string index can misclassify remaining path variables as query parameters and URL-encode them instead of slugifying.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/app-store/routing-forms/lib/substituteVariables.ts, line 43:
<comment>Computing `variableIndex` from the mutated URL without updating the query-string index can misclassify remaining path variables as query parameters and URL-encode them instead of slugifying.</comment>
<file context>
@@ -40,7 +40,7 @@ export const substituteVariables = (
const variablePattern = `{${variable}}`;
- const variableIndex = routeValue.indexOf(variablePattern);
+ const variableIndex = eventTypeUrl.indexOf(variablePattern);
const isInQueryString = queryStringIndex !== -1 && variableIndex > queryStringIndex;
</file context>
What does this PR do?
Summary by cubic
Fixes routing form variable substitution to preserve original values in query parameters while still slugifying path segments. Prevents unexpected slugification in query strings by URL-encoding values instead.
Written for commit 2be3076. Summary will update automatically on new commits.