Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix `found 0 byte sized chunk` error on attaching files

Abdullah Atta27a0aeb170a8
diff --git a/apps/web/src/interfaces/opfs.worker.ts b/apps/web/src/interfaces/opfs.worker.ts
index 7369af269..82efe0eec 100644
--- a/apps/web/src/interfaces/opfs.worker.ts
+++ b/apps/web/src/interfaces/opfs.worker.ts
@@ -198,5 +198,7 @@ async function readFileSize(
) {
const file = await directory.getFileHandle(name);
const handle = await file.createSyncAccessHandle({ mode: "read-only" });
- return handle.getSize();
+ const size = handle.getSize();
+ handle.close();
+ return size;
}