mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-24 11:26:31 +00:00
Fix an issue where the redirects of potentially malicious images were not going through. (#2666)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user