mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
contrary to what I believed encodeURIComponent() is available also in node.js, #4478
This commit is contained in:
@@ -154,9 +154,8 @@ function processContent(images, note, content) {
|
||||
|
||||
const attachment = imageService.saveImageToAttachment(note.noteId, buffer, filename, true);
|
||||
|
||||
// We might want to replace with escape-html. For non-latin-based languages, this doesn't work well.
|
||||
const sanitizedTitle = attachment.title.replace(/[^a-z0-9-.]/gi, "") || "attachment";
|
||||
const url = `api/attachments/${attachment.attachmentId}/image/${sanitizedTitle}`;
|
||||
const encodedTitle = encodeURIComponent(attachment.title);
|
||||
const url = `api/attachments/${attachment.attachmentId}/image/${encodedTitle}`;
|
||||
|
||||
log.info(`Replacing '${imageId}' with '${url}' in note '${note.noteId}'`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user