Skip to content

Conversation

@anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Nov 28, 2025

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.

  • Bug Fixes
    • Detect variables in the query string and apply encodeURIComponent.
    • Keep slugification for path variables only.
    • Add unit tests covering both behaviors.

Written for commit 2be3076. Summary will update automatically on new commits.

@keithwillcode keithwillcode added the core area: core, team members only label Nov 28, 2025
Removed comments explaining query string handling and URL encoding.
@vercel
Copy link

vercel bot commented Nov 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Nov 28, 2025 7:58am
cal-eu Ignored Ignored Nov 28, 2025 7:58am

Copy link
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.

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

Copy link
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.

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

Copy link
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.

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);
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 28, 2025

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 &amp;&amp; variableIndex &gt; queryStringIndex;
 
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants