diff --git a/src/app/admin/import/audit/audit-client.tsx b/src/app/admin/import/audit/audit-client.tsx index 64c918f3b9..a4e6a2db1e 100644 --- a/src/app/admin/import/audit/audit-client.tsx +++ b/src/app/admin/import/audit/audit-client.tsx @@ -104,6 +104,19 @@ export function AuditClient() { return; } + if (!res.headers.get("content-type")?.includes("text/event-stream")) { + let errMsg = "Audit failed"; + try { + const json = await res.json(); + errMsg = json.error || errMsg; + } catch { + // ignore + } + toast.error(errMsg); + setLoading(false); + return; + } + const reader = res.body.getReader(); const decoder = new TextDecoder(); let buf = ""; diff --git a/src/app/admin/import/repair-icons/repair-icons-client.tsx b/src/app/admin/import/repair-icons/repair-icons-client.tsx index 1c479dce8c..c126c305fc 100644 --- a/src/app/admin/import/repair-icons/repair-icons-client.tsx +++ b/src/app/admin/import/repair-icons/repair-icons-client.tsx @@ -49,6 +49,19 @@ export function RepairIconsClient() { return; } + if (!res.headers.get("content-type")?.includes("text/event-stream")) { + let errMsg = "Repair failed"; + try { + const json = await res.json(); + errMsg = json.error || errMsg; + } catch { + // ignore + } + toast.error(errMsg); + setRunning(false); + return; + } + const reader = res.body.getReader(); const decoder = new TextDecoder(); let buf = "";