mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	bug fixes for custom handlers
This commit is contained in:
		| @@ -34,8 +34,7 @@ async function uploadFile(req) { | ||||
|     }; | ||||
| } | ||||
|  | ||||
| async function downloadFile(req, res) { | ||||
|     const noteId = req.params.noteId; | ||||
| async function downloadNoteFile(noteId, res) { | ||||
|     const note = await repository.getNote(noteId); | ||||
|  | ||||
|     if (!note) { | ||||
| @@ -43,8 +42,7 @@ async function downloadFile(req, res) { | ||||
|     } | ||||
|  | ||||
|     if (note.isProtected && !protectedSessionService.isProtectedSessionAvailable()) { | ||||
|         res.status(401).send("Protected session not available"); | ||||
|         return; | ||||
|         return res.status(401).send("Protected session not available"); | ||||
|     } | ||||
|  | ||||
|     const originalFileName = await note.getLabel('originalFileName'); | ||||
| @@ -56,7 +54,15 @@ async function downloadFile(req, res) { | ||||
|     res.send(note.content); | ||||
| } | ||||
|  | ||||
| async function downloadFile(req, res) { | ||||
|     const noteId = req.params.noteId; | ||||
|  | ||||
|     return await downloadNoteFile(noteId, res); | ||||
|  | ||||
| } | ||||
|  | ||||
| module.exports = { | ||||
|     uploadFile, | ||||
|     downloadFile | ||||
|     downloadFile, | ||||
|     downloadNoteFile | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user