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: filter out attachments without a hash
thecodrr365f5b903ec3
diff --git a/packages/core/collections/content.js b/packages/core/collections/content.jsindex 69c86cc22..767e45c9c 100644--- a/packages/core/collections/content.js+++ b/packages/core/collections/content.js@@ -117,11 +117,16 @@ export default class Content extends Collection {);const toDelete = noteAttachments.filter((attachment) => {- return attachments.every((a) => a.hash !== attachment.metadata.hash);+ return attachments.every(+ (a) => a.hash && a.hash !== attachment.metadata.hash+ );});const toAdd = attachments.filter((attachment) => {- return noteAttachments.every((a) => attachment.hash !== a.metadata.hash);+ return (+ attachment.hash &&+ noteAttachments.every((a) => attachment.hash !== a.metadata.hash)+ );});for (let attachment of toDelete) {diff --git a/packages/core/content-types/tiny.js b/packages/core/content-types/tiny.jsindex 265d0bae3..1f9fe6bc5 100644--- a/packages/core/content-types/tiny.js+++ b/packages/core/content-types/tiny.js@@ -94,7 +94,13 @@ class Tiny {const type =getDatasetAttribute(attachment, "mime") || mime || "image/jpeg";- const { key, metadata } = await store(data, "base64");++ const storeResult = await store(data, "base64");+ if (!storeResult) continue;++ const { key, metadata } = storeResult;+ if (!metadata.hash) continue;+setDatasetAttribute(attachment, "hash", metadata.hash);attachments.push({