A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: restore attachment files even if they are already uploaded
Abdullah Atta2aee26b0828e
diff --git a/apps/web/src/common/index.ts b/apps/web/src/common/index.tsindex 98b2a97f1..44882e0eb 100644--- a/apps/web/src/common/index.ts+++ b/apps/web/src/common/index.ts@@ -282,9 +282,7 @@ export async function restoreBackupFile(backupFile: File) {});await db.initCollections();- const { ABYTES, streamablefs, hashStream } = await import(- "../interfaces/fs"- );+ const { ABYTES, streamablefs } = await import("../interfaces/fs");let current = 0;for (const entry of attachments) {const hash = entry.name.replace("attachments/", "");@@ -297,27 +295,6 @@ export async function restoreBackupFile(backupFile: File) {const attachment = await db.attachments.attachment(hash);if (!attachment) continue;- if (attachment.dateUploaded) {- const key = await db.attachments.decryptKey(attachment.key);- if (!key) continue;- const result = await hashStream(- entry- .stream()- .pipeThrough(- new ChunkedStream(- attachment.chunkSize + ABYTES,- isFeatureSupported("opfs") ? "copy" : "nocopy"- )- )- .pipeThrough(- await NNCrypto.createDecryptionStream(key, attachment.iv)- )- .getReader()- );- if (result.hash !== attachment.hash) continue;- await db.attachments.reset(attachment.id);- }- if (await db.fs().exists(attachment.hash)) continue;await streamablefs.deleteFile(attachment.hash);const handle = await streamablefs.createFile(