Description
Describe the bug
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 parametersomething
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``
@opennextjs/cloudflare version
1.0.0-beta.0
Wrangler version
3.112.0
next info output
Not relevant to this problem
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