From 536df17c2e170f562e3c908f97f5a0579fdc69da Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Thu, 28 Sep 2023 10:17:11 -0500 Subject: Make everything look better again Signed-off-by: Matt Strapp --- app/src/lib/ts/download.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/src/lib/ts/download.ts') diff --git a/app/src/lib/ts/download.ts b/app/src/lib/ts/download.ts index 16712fb..c3e98b0 100644 --- a/app/src/lib/ts/download.ts +++ b/app/src/lib/ts/download.ts @@ -19,10 +19,11 @@ export default async function saveFile(blob: ArrayBuffer, suggestedName: string const writable = await handle.createWritable(); await writable.write(blob); await writable.close(); + return; } catch (err: unknown) { // TypeScript if ((err as Error)?.name !== 'AbortError') { - console.error(err); + return Promise.reject(err); } } } else { @@ -30,5 +31,7 @@ export default async function saveFile(blob: ArrayBuffer, suggestedName: string anchor.download = suggestedName ?? 'truncated'; anchor.href = URL.createObjectURL(new Blob([blob])); anchor.click(); + URL.revokeObjectURL(anchor.href); + document.body.removeChild(anchor); } } -- cgit v1.2.3