diff --git a/lib/note/noteActions.js b/lib/note/noteActions.js index d9c57da21..964f4505d 100644 --- a/lib/note/noteActions.js +++ b/lib/note/noteActions.js @@ -133,14 +133,17 @@ async function actionPandoc (req, res, note) { content = content.replace(/\]\(\//g, '](' + url + '/') const { exportType } = req.query + if (typeof exportType !== 'string') { + return res.sendStatus(400) + } + const contentType = outputFormats[exportType] + if (!contentType) { + return res.sendStatus(400) + } try { // TODO: timeout rejection - if (!contentType) { - return res.sendStatus(400) - } - await pandoc.convertToFile(content, 'markdown', exportType, path, [ '--metadata', `title=${title}`, '--sandbox' ])