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
When logging request.url in the middleware, or accessing a query parameter with new URL(request.url).searchParams.get('something'), the returned value is URL-decoded when it should not
For example loading https://deployedapp.com/?something=General%2520Banner would log 2 different things:
The following code:
export async function middleware(request: NextRequest) {
console.log(new URL(request.url).searchParams.get('something'));
}
On Vercel or locally: General%20Banner (as expected)
With OpenNext: General Banner (the value is decoded twice).
Steps to reproduce
Log new URL(request.url).searchParams.get('something') in a middleware
Open a URL like https://deployedapp.com/?something=General%2520Banner where the parameter something is encoded twice (ex: when passing a URL as a query param)
Notice it logs a different value on OpenNext vs Next
Expected behavior
Both should log the value value `General%20Banner``
Good catch, we'll need to revert this one partially opennextjs/opennextjs-aws#603.
I'll have to check if it doesn't break the other part of the PR though
@SamyPesse Yeah you can do that, i've started working on this here opennextjs/opennextjs-aws#817, but it doesn't seem to be enough.
I'll need to dig deeper into this to figure out what's going on here
Describe the bug
When logging
request.url
in the middleware, or accessing a query parameter withnew URL(request.url).searchParams.get('something')
, the returned value is URL-decoded when it should notFor example loading
https://deployedapp.com/?something=General%2520Banner
would log 2 different things:The following code:
On Vercel or locally:
General%20Banner
(as expected)With OpenNext:
General Banner
(the value is decoded twice).Steps to reproduce
new URL(request.url).searchParams.get('something')
in a middlewarehttps://deployedapp.com/?something=General%2520Banner
where the parametersomething
is encoded twice (ex: when passing a URL as a query param)Expected behavior
Both should log the value value `General%20Banner``
@opennextjs/cloudflare version
1.0.0-beta.0
Wrangler version
3.112.0
next info output
Additional context
I think the problem comes from these lines https://github.com/opennextjs/opennextjs-aws/blob/main/packages/open-next/src/core/routing/util.ts#L134-L136
The text was updated successfully, but these errors were encountered: