Redirect to original image when cloudflare resize is returning an error (#90)

This commit is contained in:
Samy Pessé
2024-01-09 14:05:32 +01:00
committed by GitHub
parent e7c184cc99
commit f4ac246a09
+4
View File
@@ -64,6 +64,10 @@ export async function GET(request: NextRequest) {
try {
const response = await resizeImage(url, options);
if (!response.ok) {
throw new Error('Failed to resize image');
}
return response;
} catch (error) {
// Redirect to the original image if resizing fails