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: images are not attached on note publish
thecodrr2cc5ec74c2f4
diff --git a/packages/core/api/sync/merger.js b/packages/core/api/sync/merger.jsindex dd4eb87ec..06fef34a0 100644--- a/packages/core/api/sync/merger.js+++ b/packages/core/api/sync/merger.js@@ -125,7 +125,7 @@ class Merger {noteIds);}- await this._db.attachments.add(remoteAttachment);+ await this._db.attachments.merge(remoteAttachment);});await this._mergeArray(diff --git a/packages/core/collections/attachments.js b/packages/core/collections/attachments.jsindex bfd4458ad..e46dfbcd0 100644--- a/packages/core/collections/attachments.js+++ b/packages/core/collections/attachments.js@@ -226,30 +226,22 @@ export default class Attachments extends Collection {);try {for (let i = 0; i < attachments.length; i++) {- const { metadata, chunkSize } = attachments[i];- await this._downloadMedia(- metadata.hash,- chunkSize,- {- total: attachments.length,- current: i,- groupId: noteId,- },- metadata- );+ const attachment = attachments[i];+ await this._downloadMedia(attachment, {+ total: attachments.length,+ current: i,+ groupId: noteId,+ });}} finally {sendAttachmentsProgressEvent("download", noteId, attachments.length);}}- async _downloadMedia(- filename,- chunkSize,- { total, current, groupId },- metadata,- notify = true- ) {+ async _downloadMedia(attachment, { total, current, groupId }, notify = true) {+ const { metadata, chunkSize } = attachment;+ const filename = metadata.hash;+sendAttachmentsProgressEvent("download", groupId, total, current);const isDownloaded = await this._db.fs.downloadFile(groupId,diff --git a/packages/core/collections/content.js b/packages/core/collections/content.jsindex 8062144a7..69c86cc22 100644--- a/packages/core/collections/content.js+++ b/packages/core/collections/content.js@@ -76,16 +76,15 @@ export default class Content extends Collection {const attachment = this._db.attachments.attachment(hash);if (!attachment) return;- const metadata = attachment.metadata;const progressData = {total,current,groupId,};+return this._db.attachments._downloadMedia(- metadata.hash,+ attachment,progressData,- metadata,notify);});