mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	attach extension to download file if note present
This commit is contained in:
		| @@ -1,6 +1,5 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const noteService = require('../../services/notes'); | ||||
| const protectedSessionService = require('../../services/protected_session'); | ||||
| const repository = require('../../services/repository'); | ||||
| const utils = require('../../services/utils'); | ||||
| @@ -45,7 +44,9 @@ async function downloadNoteFile(noteId, res, contentDisposition = true) { | ||||
|     if (contentDisposition) { | ||||
|         // (one) reason we're not using the originFileName (available as label) is that it's not | ||||
|         // available for older note revisions and thus would be inconsistent | ||||
|         res.setHeader('Content-Disposition', utils.getContentDisposition(note.title || "untitled")); | ||||
|         const filename = utils.formatDownloadTitle(note.title, note.type, note.mime); | ||||
|  | ||||
|         res.setHeader('Content-Disposition', utils.getContentDisposition(filename)); | ||||
|     } | ||||
|  | ||||
|     res.setHeader('Content-Type', note.mime); | ||||
| @@ -70,4 +71,4 @@ module.exports = { | ||||
|     openFile, | ||||
|     downloadFile, | ||||
|     downloadNoteFile | ||||
| }; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user