Skip to content

Commit

Permalink
Merge pull request #1847 from hackmdio/chore/bump-pandoc-js
Browse files Browse the repository at this point in the history
Address pandoc related issues
  • Loading branch information
Yukaii committed Jan 4, 2024
2 parents cc78023 + cd52cb7 commit 9846143
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 49 deletions.
11 changes: 7 additions & 4 deletions lib/note/noteActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
])
Expand Down

0 comments on commit 9846143

Please sign in to comment.