Skip to content

Build your personal knowledge base with Trilium Notes

Merge branch 'stable'

zadamed0079717947
diff --cc src/services/notes.js
index 7293e23d28,c325bba9bb..aa7e0eb3e5
--- a/src/services/notes.js
+++ b/src/services/notes.js
@@@ -526,12 -526,12 +526,12 @@@ function downloadImages(noteId, content
const imageBase64 = url.substr(inlineImageMatch[0].length);
const imageBuffer = Buffer.from(imageBase64, 'base64');
- const imageService = require('../services/image');
+ const imageService = require('../services/image.js');
const attachment = imageService.saveImageToAttachment(noteId, imageBuffer, "inline image", true, true);
- const sanitizedTitle = attachment.title.replace(/[^a-z0-9-.]/gi, "");
+ const encodedTitle = encodeURIComponent(attachment.title);
- content = `${content.substr(0, imageMatch.index)}<img src="api/attachments/${attachment.attachmentId}/image/${sanitizedTitle}"${content.substr(imageMatch.index + imageMatch[0].length)}`;
+ content = `${content.substr(0, imageMatch.index)}<img src="api/attachments/${attachment.attachmentId}/image/${encodedTitle}"${content.substr(imageMatch.index + imageMatch[0].length)}`;
}
else if (!url.includes('api/images/') && !/api\/attachments\/.+\/image\/?.*/.test(url)
// this is an exception for the web clipper's "imageId"