From 439743d2b099dc66ce0b8afeaabe917abf4b7c12 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 27 Dec 2023 23:22:40 +0100 Subject: [PATCH] convert absolute image attachment URLs to relative without domain, fixes #4509 --- src/services/notes.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/notes.js b/src/services/notes.js index c325bba9b..6e6bbfd76 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -636,6 +636,10 @@ function saveAttachments(note, content) { content = `${content.substr(0, attachmentMatch.index)}${title}${content.substr(attachmentMatch.index + attachmentMatch[0].length)}`; } + // removing absolute references to server to keep it working between instances, + // we also omit / at the beginning to keep the paths relative + content = content.replace(/src="[^"]*\/api\/attachments\//g, 'src="api/attachments/'); + return content; }