mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 04:16:17 +01:00 
			
		
		
		
	fix thumbnails with chinese titles, closes #4478
This commit is contained in:
		@@ -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