mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	fix setting exported file extension when truncated
This commit is contained in:
		
							parent
							
								
									a098630e09
								
							
						
					
					
						commit
						1aff42f453
					
				| @ -50,7 +50,13 @@ function exportToZip(taskContext, branch, format, res) { | ||||
|     } | ||||
| 
 | ||||
|     function getDataFileName(note, baseFileName, existingFileNames) { | ||||
|         const existingExtension = path.extname(baseFileName).toLowerCase(); | ||||
|         let fileName = baseFileName; | ||||
| 
 | ||||
|         if (fileName.length > 30) { | ||||
|             fileName = fileName.substr(0, 30); | ||||
|         } | ||||
| 
 | ||||
|         let existingExtension = path.extname(fileName).toLowerCase(); | ||||
|         let newExtension; | ||||
| 
 | ||||
|         // following two are handled specifically since we always want to have these extensions no matter the automatic detection
 | ||||
| @ -67,14 +73,13 @@ function exportToZip(taskContext, branch, format, res) { | ||||
|         else if (existingExtension.length > 0) { // if the page already has an extension, then we'll just keep it
 | ||||
|             newExtension = null; | ||||
|         } | ||||
|         else { | ||||
|             if (note.mime?.toLowerCase()?.trim() === "image/jpg") { | ||||
|                 newExtension = 'jpg'; | ||||
|             } | ||||
|             else { | ||||
|                 newExtension = mimeTypes.extension(note.mime) || "dat"; | ||||
|             } | ||||
| 
 | ||||
|         let fileName = baseFileName; | ||||
| 
 | ||||
|         if (fileName.length > 30) { | ||||
|             fileName = fileName.substr(0, 30); | ||||
|         } | ||||
| 
 | ||||
|         // if the note is already named with extension (e.g. "jquery"), then it's silly to append exact same extension again
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam