mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 03:00:41 +01:00
fix thumbnails with chinese titles, closes #4478
This commit is contained in:
@@ -303,7 +303,8 @@ function importEnex(taskContext, file, parentNote) {
|
||||
|
||||
const attachment = imageService.saveImageToAttachment(noteEntity.noteId, resource.content, originalName, taskContext.data.shrinkImages);
|
||||
|
||||
const sanitizedTitle = attachment.title.replace(/[^a-z0-9-.]/gi, "");
|
||||
// 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 imageLink = `<img src="${url}">`;
|
||||
|
||||
|
||||
@@ -529,7 +529,8 @@ function downloadImages(noteId, content) {
|
||||
const imageService = require('../services/image');
|
||||
const attachment = imageService.saveImageToAttachment(noteId, imageBuffer, "inline image", true, true);
|
||||
|
||||
const sanitizedTitle = attachment.title.replace(/[^a-z0-9-.]/gi, "");
|
||||
// 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";
|
||||
|
||||
content = `${content.substr(0, imageMatch.index)}<img src="api/attachments/${attachment.attachmentId}/image/${sanitizedTitle}"${content.substr(imageMatch.index + imageMatch[0].length)}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user