You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a strange issue with how URLs containing encoded query parameters are processed in Inertia.js v2. Specifically, when passing an encoded URL as a query parameter, the resulting behavior seems inconsistent, especially when dots (.) are included in the parameter value. I wanted to ask if this could be a bug or if I might be doing something incorrectly.
Steps to Reproduce
Here’s a minimal example:
consttestUrl="https://example.com?redirect_url=https%3A%2F%2Fexample.com%2Fpath";// Simulate URL processing (similar to how Inertia might handle it)functionsimulateUrlProcessing(href){consturl=newURL(href);// Convert string to URL objectconstqueryParams=newURLSearchParams(url.search);// Parse query paramsconsole.log("Parsed query parameters:",Object.fromEntries(queryParams.entries()));// Rebuild the URLconstnewQueryParams=newURLSearchParams(queryParams);constrebuiltUrl=`${url.origin}${url.pathname}?${newQueryParams.toString()}`;console.log("Rebuilt URL:",rebuiltUrl);returnrebuiltUrl;}// Test with a problematic URLsimulateUrlProcessing(testUrl);
Observed Behavior
When the query parameter (redirect_url) contains encoded dots (.), slashes (/), and colons (:), the resulting URL sometimes:
Misinterprets the parameter as part of the path.
Incorrectly re-encodes the query string during processing.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello guys,
I encountered a strange issue with how URLs containing encoded query parameters are processed in Inertia.js v2. Specifically, when passing an encoded URL as a query parameter, the resulting behavior seems inconsistent, especially when dots (
.
) are included in the parameter value. I wanted to ask if this could be a bug or if I might be doing something incorrectly.Steps to Reproduce
Here’s a minimal example:
Observed Behavior
When the query parameter (
redirect_url
) contains encoded dots (.
), slashes (/
), and colons (:
), the resulting URL sometimes:For example, the input:
Results in:
If dots (
.
) are replaced with another character, the output changes and behaves as expected:Questions
URL
objects or query parameter encoding are handled internally?I’d love any guidance on how to resolve this or confirm if this might be an issue.
Beta Was this translation helpful? Give feedback.
All reactions