mirror of https://github.com/status-im/codimd.git
Merge pull request #963 from SISheogorath/fix/crashPDF
Fix server crash on PDF creation
This commit is contained in:
commit
9e4d165663
|
@ -341,6 +341,10 @@ function actionPDF (req, res, note) {
|
||||||
var path = config.tmpPath + '/' + Date.now() + '.pdf'
|
var path = config.tmpPath + '/' + Date.now() + '.pdf'
|
||||||
content = content.replace(/\]\(\//g, '](' + url + '/')
|
content = content.replace(/\]\(\//g, '](' + url + '/')
|
||||||
markdownpdf().from.string(content).to(path, function () {
|
markdownpdf().from.string(content).to(path, function () {
|
||||||
|
if (!fs.existsSync(path)) {
|
||||||
|
logger.error('PDF seems to not be generated as expected. File doesn\'t exist: ' + path)
|
||||||
|
return response.errorInternalError(res)
|
||||||
|
}
|
||||||
var stream = fs.createReadStream(path)
|
var stream = fs.createReadStream(path)
|
||||||
var filename = title
|
var filename = title
|
||||||
// Be careful of special characters
|
// Be careful of special characters
|
||||||
|
|
Loading…
Reference in New Issue