Skip to content

Commit cf76f85

Browse files
committed
fix: handling imgproxy errors properly
1 parent 026853a commit cf76f85

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ app.get('/:path', async ({ query, params }) => {
2929
const imgproxyUrl = new URL(ImgproxyURL + imgproxyPath);
3030

3131
const data = await fetch(imgproxyUrl.href);
32+
33+
if (!data.ok) {
34+
return new Response("Error fetching image", { status: data.status });
35+
}
36+
3237
return new Response(data.body, {
3338
headers: {
3439
'Content-Type': data.headers.get('Content-Type') || 'image/jpeg'

0 commit comments

Comments
 (0)