Skip to content

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

core: always keep remote attachment if it is newer

Abdullah Atta6abb6207c513
diff --git a/packages/core/src/collections/attachments.js b/packages/core/src/collections/attachments.js
index f4178557c..0a5d9a167 100644
--- a/packages/core/src/collections/attachments.js
+++ b/packages/core/src/collections/attachments.js
@@ -39,6 +39,9 @@ export default class Attachments extends Collection {
merge(localAttachment, remoteAttachment) {
if (remoteAttachment.deleted) return remoteAttachment;
+ if (remoteAttachment.dateModified > localAttachment.dateModified)
+ return remoteAttachment;
+
if (localAttachment && localAttachment.noteIds) {
remoteAttachment.noteIds = setManipulator.union(
remoteAttachment.noteIds,