Fix an issue where the redirects of potentially malicious images were not going through. (#2666)

This commit is contained in:
Steven H
2024-12-30 14:41:54 +00:00
committed by GitHub
parent db74ea3001
commit e86e51f06f
2 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'gitbook': minor
---
Fix an issue where the redirects of potentially malicious images were not going through.
@@ -1,4 +1,4 @@
import { NextRequest } from 'next/server';
import { NextRequest, NextResponse } from 'next/server';
import {
CURRENT_SIGNATURE_VERSION,
@@ -45,7 +45,7 @@ export async function GET(request: NextRequest) {
}
if (signatureVersion !== CURRENT_SIGNATURE_VERSION) {
return Response.redirect(url, 302);
return NextResponse.redirect(url, 302);
}
// Cloudflare-specific options are in the cf object.
@@ -92,7 +92,7 @@ export async function GET(request: NextRequest) {
return response;
} catch (error) {
// Redirect to the original image if resizing fails
return Response.redirect(url, 302);
return NextResponse.redirect(url, 302);
}
}