mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	process only whitelisted mime types as an image, fixes #288
This commit is contained in:
		
							parent
							
								
									523ccdad6b
								
							
						
					
					
						commit
						8e8fd88857
					
				@ -144,7 +144,7 @@ async function importEnex(file, parentNote) {
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
            else if (currentTag === 'mime') {
 | 
			
		||||
                resource.mime = text;
 | 
			
		||||
                resource.mime = text.toLowerCase();
 | 
			
		||||
 | 
			
		||||
                if (text.startsWith("image/")) {
 | 
			
		||||
                    resource.title = "image";
 | 
			
		||||
@ -222,7 +222,7 @@ async function importEnex(file, parentNote) {
 | 
			
		||||
 | 
			
		||||
            const mediaRegex = new RegExp(`<en-media hash="${hash}"[^>]*>`, 'g');
 | 
			
		||||
 | 
			
		||||
            if (resource.mime.startsWith("image/")) {
 | 
			
		||||
            if (["image/jpeg", "image/png", "image/gif"].includes(resource.mime)) {
 | 
			
		||||
                const originalName = "image." + resource.mime.substr(6);
 | 
			
		||||
 | 
			
		||||
                const { url } = await imageService.saveImage(resource.content, originalName, noteEntity.noteId);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user