core: merge remote attachment if local attachment doesn't exist

This commit is contained in:
Abdullah Atta
2023-09-06 11:40:44 +05:00
parent 6abb6207c5
commit 308eb4b55f

View File

@@ -39,7 +39,10 @@ export default class Attachments extends Collection {
merge(localAttachment, remoteAttachment) {
if (remoteAttachment.deleted) return remoteAttachment;
if (remoteAttachment.dateModified > localAttachment.dateModified)
if (
!localAttachment ||
remoteAttachment.dateModified > localAttachment.dateModified
)
return remoteAttachment;
if (localAttachment && localAttachment.noteIds) {