File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
packages/open-next/src/core/routing Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -464,13 +464,11 @@ export function normalizeLocationHeader(
464464 const locationURL = new URL ( location ) ;
465465 const origin = new URL ( baseUrl ) . origin ;
466466
467- // Redirects from the middleware do not encode the query parameters
468467 let search = locationURL . search ;
469468 // If encodeQuery is true, we need to encode the query parameters
470- // This is used for redirects from Next config
471469 // We could have used URLSearchParams, but that doesn't match what Next does.
472- if ( encodeQuery ) {
473- search = search ? `?${ stringifyQs ( parseQs ( search . slice ( 1 ) ) ) } ` : "" ;
470+ if ( encodeQuery && search ) {
471+ search = `?${ stringifyQs ( parseQs ( search . slice ( 1 ) ) ) } ` ;
474472 }
475473 const href = `${ locationURL . origin } ${ locationURL . pathname } ${ search } ${ locationURL . hash } ` ;
476474 // The URL is relative if the origin is the same as the base URL's origin
You can’t perform that action at this time.
0 commit comments