Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix content renderer of protected canvas/mermaid notes, closes #4414
zadam5a38bf78e111
diff --git a/src/becca/entities/bnote.js b/src/becca/entities/bnote.jsindex 27cad3f264..f3f98fe5cd 100644--- a/src/becca/entities/bnote.js+++ b/src/becca/entities/bnote.js@@ -1156,14 +1156,8 @@ class BNote extends AbstractBeccaEntity {/** @returns {BAttachment} */getAttachmentByTitle(title) {- return sql.getRows(`- SELECT attachments.*- FROM attachments- WHERE ownerId = ?- AND title = ?- AND isDeleted = 0- ORDER BY position`, [this.noteId, title])- .map(row => new BAttachment(row))[0];+ // cannot use SQL to filter by title since it can be encrypted+ return this.getAttachments().filter(attachment => attachment.title === title)[0];}/**diff --git a/src/becca/entities/brevision.js b/src/becca/entities/brevision.jsindex 09a78db643..de9bfbd825 100644--- a/src/becca/entities/brevision.js+++ b/src/becca/entities/brevision.js@@ -157,14 +157,8 @@ class BRevision extends AbstractBeccaEntity {/** @returns {BAttachment} */getAttachmentByTitle(title) {- return sql.getRows(`- SELECT attachments.*- FROM attachments- WHERE ownerId = ?- AND title = ?- AND isDeleted = 0- ORDER BY position`, [this.revisionId, title])- .map(row => new BAttachment(row))[0];+ // cannot use SQL to filter by title since it can be encrypted+ return this.getAttachments().filter(attachment => attachment.title === title)[0];}beforeSaving() {