File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
packages/runtime/src/templates/edge-shared Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ export interface FetchEventResult {
9
9
type NextDataTransform = < T > ( data : T ) => T
10
10
11
11
function normalizeDataUrl ( redirect : string ) {
12
+ // If the redirect is a data URL, we need to normalize it.
13
+ // next.js code reference: https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/router/utils/get-next-pathname-info.ts#L46
12
14
if ( redirect . startsWith ( '/_next/data/' ) && redirect . includes ( '.json' ) ) {
13
15
const paths = redirect
14
16
. replace ( / ^ \/ _ n e x t \/ d a t a \/ / , '' )
@@ -266,7 +268,7 @@ export const buildResponse = async ({
266
268
267
269
const nextRedirect = res . headers . get ( 'x-nextjs-redirect' )
268
270
269
- if ( nextRedirect ) {
271
+ if ( nextRedirect ) {
270
272
res . headers . set ( 'x-nextjs-redirect' , normalizeDataUrl ( nextRedirect ) )
271
273
}
272
274
You can’t perform that action at this time.
0 commit comments