Skip to content

Commit f09cf7d

Browse files
committed
fix: added ref link
1 parent a6d69b2 commit f09cf7d

File tree

1 file changed

+3
-1
lines changed
  • packages/runtime/src/templates/edge-shared

1 file changed

+3
-1
lines changed

packages/runtime/src/templates/edge-shared/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export interface FetchEventResult {
99
type NextDataTransform = <T>(data: T) => T
1010

1111
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
1214
if (redirect.startsWith('/_next/data/') && redirect.includes('.json')) {
1315
const paths = redirect
1416
.replace(/^\/_next\/data\//, '')
@@ -266,7 +268,7 @@ export const buildResponse = async ({
266268

267269
const nextRedirect = res.headers.get('x-nextjs-redirect')
268270

269-
if ( nextRedirect ){
271+
if (nextRedirect) {
270272
res.headers.set('x-nextjs-redirect', normalizeDataUrl(nextRedirect))
271273
}
272274

0 commit comments

Comments
 (0)