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
make file attachments accessible in revisions dialog
zadama748710b01e2
diff --git a/src/becca/entities/bnote.js b/src/becca/entities/bnote.jsindex ec7314b305..fdea88e262 100644--- a/src/becca/entities/bnote.js+++ b/src/becca/entities/bnote.js@@ -1594,7 +1594,11 @@ class BNote extends AbstractBeccaEntity {revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true});// content is rewritten to point to the revision attachments- noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`, `attachments/${revisionAttachment.attachmentId}`);+ noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`,+ `attachments/${revisionAttachment.attachmentId}`);++ noteContent = noteContent.replaceAll(new RegExp(`href="[^"]*attachmentId=${noteAttachment.attachmentId}[^"]*"`, 'gi'),+ `href="api/attachments/${revisionAttachment.attachmentId}/download"`);}revision.setContent(noteContent, {forceSave: true});diff --git a/src/public/app/services/froca.js b/src/public/app/services/froca.jsindex 6c947888e4..9d45686fa0 100644--- a/src/public/app/services/froca.js+++ b/src/public/app/services/froca.js@@ -328,7 +328,7 @@ class Froca {}catch (e) {if (silentNotFoundError) {- logInfo(`Attachment '${attachmentId} not found, but silentNotFoundError is enabled: ` + e.message);+ logInfo(`Attachment '${attachmentId}' not found, but silentNotFoundError is enabled: ` + e.message);return null;} else {throw e;diff --git a/src/public/app/services/link.js b/src/public/app/services/link.jsindex c96a5ad7b9..f2c0e9ee3f 100644--- a/src/public/app/services/link.js+++ b/src/public/app/services/link.js@@ -228,7 +228,7 @@ function goToLink(evt) {|| (withinEditLink && (leftClick || middleClick))|| (outsideOfCKEditor && (leftClick || middleClick))) {- if (hrefLink.toLowerCase().startsWith('http')) {+ if (hrefLink.toLowerCase().startsWith('http') || hrefLink.startsWith("api/")) {window.open(hrefLink, '_blank');}else if (hrefLink.toLowerCase().startsWith('file:') && utils.isElectron()) {