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
fix: only delete att. file if att. is uploaded
thecodrr6e344fbdacc1
diff --git a/apps/web/src/common/attachments.js b/apps/web/src/common/attachments.jsindex 713639ea9..8f08a7ece 100644--- a/apps/web/src/common/attachments.js+++ b/apps/web/src/common/attachments.js@@ -20,5 +20,6 @@ export async function downloadAttachment(hash) {iv: attachment.iv,name: attachment.metadata.filename,type: attachment.metadata.type,+ isUploaded: !!attachment.dateUploaded,});}diff --git a/apps/web/src/interfaces/fs.js b/apps/web/src/interfaces/fs.jsindex 51fc5b9a7..235522c21 100644--- a/apps/web/src/interfaces/fs.js+++ b/apps/web/src/interfaces/fs.js@@ -343,10 +343,14 @@ function exists(filename) {return streamablefs.exists(filename);}-async function saveFile(filename, { key, iv, name, type }) {+async function saveFile(filename, fileMetadata) {+ if (!fileMetadata) return false;+const fileHandle = await streamablefs.readFile(filename);if (!fileHandle) return false;+ const { key, iv, name, type, isUploaded } = fileMetadata;+const blobParts = [];const reader = fileHandle.getReader();@@ -366,7 +370,8 @@ async function saveFile(filename, { key, iv, name, type }) {filename);saveAs(new Blob(blobParts, { type }), name);- await streamablefs.deleteFile(filename);++ if (isUploaded) await streamablefs.deleteFile(filename);}async function deleteFile(filename, requestOptions) {