File tree 2 files changed +8
-3
lines changed
packages/gitbook/src/app/(global)/~gitbook/image
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' gitbook ' : minor
3
+ ---
4
+
5
+ Fix an issue where the redirects of potentially malicious images were not going through.
Original file line number Diff line number Diff line change 1
- import { NextRequest } from 'next/server' ;
1
+ import { NextRequest , NextResponse } from 'next/server' ;
2
2
3
3
import {
4
4
CURRENT_SIGNATURE_VERSION ,
@@ -45,7 +45,7 @@ export async function GET(request: NextRequest) {
45
45
}
46
46
47
47
if ( signatureVersion !== CURRENT_SIGNATURE_VERSION ) {
48
- return Response . redirect ( url , 302 ) ;
48
+ return NextResponse . redirect ( url , 302 ) ;
49
49
}
50
50
51
51
// Cloudflare-specific options are in the cf object.
@@ -92,7 +92,7 @@ export async function GET(request: NextRequest) {
92
92
return response ;
93
93
} catch ( error ) {
94
94
// Redirect to the original image if resizing fails
95
- return Response . redirect ( url , 302 ) ;
95
+ return NextResponse . redirect ( url , 302 ) ;
96
96
}
97
97
}
98
98
You can’t perform that action at this time.
0 commit comments