Skip to content

best way to save what you love

web/storage: catch the missing dir error

wukko19a342457b64
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!
+ }
+ }
}