From 19a342457b64a013b2b154034565bb7aaafd3082 Mon Sep 17 00:00:00 2001 From: wukko Date: Sun, 2 Feb 2025 01:08:07 +0600 Subject: [PATCH] web/storage: catch the missing dir error --- web/src/lib/storage.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/lib/storage.ts b/web/src/lib/storage.ts index cae26e79..6cbb510c 100644 --- a/web/src/lib/storage.ts +++ b/web/src/lib/storage.ts @@ -54,7 +54,13 @@ export const removeFromFileStorage = async (filename: string) => { } export const clearFileStorage = async () => { - const root = await navigator.storage.getDirectory(); - return await root.removeEntry(cobaltProcessingDir, { recursive: true }); + if (navigator.storage.getDirectory) { + const root = await navigator.storage.getDirectory(); + try { + await root.removeEntry(cobaltProcessingDir, { recursive: true }); + } catch { + // ignore the error because the dir might be missing and that's okay! + } + } }