From 1d25f9f1182591476798d6987f006594f7da97c4 Mon Sep 17 00:00:00 2001 From: shrimbly Date: Wed, 15 Apr 2026 15:29:59 +1200 Subject: [PATCH] fix: add response.ok check in downloadMedia HTTP branch Prevents saving error pages as media files when server returns non-2xx. Co-Authored-By: Claude Opus 4.6 --- src/utils/downloadMedia.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/downloadMedia.ts b/src/utils/downloadMedia.ts index bea9a895..7fe712df 100644 --- a/src/utils/downloadMedia.ts +++ b/src/utils/downloadMedia.ts @@ -70,6 +70,10 @@ export async function downloadMedia( if (isHttp) { try { const response = await fetch(src); + if (!response.ok) { + console.error(`Failed to download: ${response.status} ${response.statusText}`); + return; + } const blob = await response.blob(); const blobUrl = URL.createObjectURL(blob); triggerDownload(blobUrl, finalName);