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
core: try to preserve mime type on backup restore
Abdullah Atta08621a587337
diff --git a/packages/core/src/database/backup.js b/packages/core/src/database/backup.jsindex 4835619fb..39fe4a3f3 100644--- a/packages/core/src/database/backup.js+++ b/packages/core/src/database/backup.js@@ -274,11 +274,24 @@ export default class Backup {if (itemType === "attachment" && item.metadata && item.metadata.hash) {const attachment = this._db.attachments.attachment(item.metadata.hash);if (attachment) {+ const isNewGeneric =+ item.metadata.type === "application/octet-stream";+ const isOldGeneric =+ attachment.metadata.type === "application/octet-stream";item = {...attachment,metadata: {...attachment.metadata,- type: item.metadata.type || attachment.metadata.type+ type:+ // we keep whichever mime type is more specific+ isNewGeneric && !isOldGeneric+ ? attachment.metadata.type+ : item.metadata.type,+ filename:+ // we keep the filename based on which item's mime type we kept+ isNewGeneric && !isOldGeneric+ ? attachment.metadata.filename+ : item.metadata.filename},noteIds: setManipulator.union(attachment.noteIds, item.noteIds)};