Skip to content

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

fix: do not add undefined noteIds to attachments

thecodrrff7c58ec706b
diff --git a/packages/core/collections/attachments.js b/packages/core/collections/attachments.js
index b61189d46..a20b7205c 100644
--- a/packages/core/collections/attachments.js
+++ b/packages/core/collections/attachments.js
@@ -48,7 +48,7 @@ export default class Attachments extends Collection {
(a) => a.metadata.hash === attachment.hash
);
if (oldAttachment) {
- if (oldAttachment.noteIds.includes(noteId)) return;
+ if (!noteId || oldAttachment.noteIds.includes(noteId)) return;
oldAttachment.noteIds.push(noteId);
oldAttachment.dateDeleted = undefined;