fix thumbnails with chinese titles, closes #4478

This commit is contained in:
zadam
2023-11-27 10:10:27 +01:00
parent 10f3df3ed4
commit ad74952194
7 changed files with 18 additions and 15 deletions

View File

@@ -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}">`;