Skip to content

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

core: return only attachment meta if attachment already exists

ammarahm-eda46b86380200
diff --git a/packages/core/collections/attachments.js b/packages/core/collections/attachments.js
index 0e59f8782..21753efeb 100644
--- a/packages/core/collections/attachments.js
+++ b/packages/core/collections/attachments.js
@@ -288,7 +288,10 @@ export default class Attachments extends Collection {
async save(data, mimeType) {
const { hash } = await this._db.fs.hashBase64(data);
const attachment = this.attachment(hash);
- if (attachment) return attachment;
+ if (attachment)
+ return {
+ metadata: attachment.metadata
+ };
const key = await this._db.attachments.generateKey();
const metadata = await this._db.fs.writeEncryptedBase64(