mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
added express-promise-wrap to catch and respond to unhandled exceptions immediately, previously the requests just hanged
This commit is contained in:
@@ -8,8 +8,9 @@ const sql = require('../../services/sql');
|
||||
const data_dir = require('../../services/data_dir');
|
||||
const html = require('html');
|
||||
const auth = require('../../services/auth');
|
||||
const wrap = require('express-promise-wrap').wrap;
|
||||
|
||||
router.get('/:noteId/to/:directory', auth.checkApiAuth, async (req, res, next) => {
|
||||
router.get('/:noteId/to/:directory', auth.checkApiAuth, wrap(async (req, res, next) => {
|
||||
const noteId = req.params.noteId;
|
||||
const directory = req.params.directory.replace(/[^0-9a-zA-Z_-]/gi, '');
|
||||
|
||||
@@ -30,7 +31,7 @@ router.get('/:noteId/to/:directory', auth.checkApiAuth, async (req, res, next) =
|
||||
await exportNote(noteTreeId, completeExportDir);
|
||||
|
||||
res.send({});
|
||||
});
|
||||
}));
|
||||
|
||||
async function exportNote(noteTreeId, dir) {
|
||||
const noteTree = await sql.getFirst("SELECT * FROM notes_tree WHERE note_tree_id = ?", [noteTreeId]);
|
||||
|
||||
Reference in New Issue
Block a user