Skip to content

Commit 9846143

Browse files
authored
Merge pull request #1847 from hackmdio/chore/bump-pandoc-js
Address pandoc related issues
2 parents cc78023 + cd52cb7 commit 9846143

File tree

3 files changed

+186
-49
lines changed

3 files changed

+186
-49
lines changed

lib/note/noteActions.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,17 @@ async function actionPandoc (req, res, note) {
133133
content = content.replace(/\]\(\//g, '](' + url + '/')
134134

135135
const { exportType } = req.query
136+
if (typeof exportType !== 'string') {
137+
return res.sendStatus(400)
138+
}
139+
136140
const contentType = outputFormats[exportType]
141+
if (!contentType) {
142+
return res.sendStatus(400)
143+
}
137144

138145
try {
139146
// TODO: timeout rejection
140-
if (!contentType) {
141-
return res.sendStatus(400)
142-
}
143-
144147
await pandoc.convertToFile(content, 'markdown', exportType, path, [
145148
'--metadata', `title=${title}`, '--sandbox'
146149
])

0 commit comments

Comments
 (0)