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: unlink attachments pn note delete
thecodrr8ff8b4331fff
diff --git a/packages/core/collections/attachments.js b/packages/core/collections/attachments.jsindex 5370d9994..48bfe100b 100644--- a/packages/core/collections/attachments.js+++ b/packages/core/collections/attachments.js@@ -177,7 +177,7 @@ export default class Attachments extends Collection {* Get specified type of attachments of a note* @param {string} noteId* @param {"files"|"images"|"all"} type- * @returns+ * @returns {Array}*/ofNote(noteId, type) {let attachments = [];diff --git a/packages/core/collections/notes.js b/packages/core/collections/notes.jsindex e2fb8ce18..6f0996c69 100644--- a/packages/core/collections/notes.js+++ b/packages/core/collections/notes.js@@ -202,6 +202,15 @@ export default class Notes extends Collection {if (itemData.color) {await this._db.colors.untag(itemData.color, id);}++ const attachments = this._db.attachments.ofNote(itemData.id, "all");+ for (let attachment of attachments) {+ await this._db.attachments.delete(+ attachment.metadata.hash,+ itemData.id+ );+ }+// await this._collection.removeItem(id);if (moveToTrash) await this._db.trash.add(itemData);else {