summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/response.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/response.js b/lib/response.js
index 37211998..295f91d6 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -341,6 +341,10 @@ function actionPDF (req, res, note) {
var path = config.tmpPath + '/' + Date.now() + '.pdf'
content = content.replace(/\]\(\//g, '](' + url + '/')
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 filename = title
// Be careful of special characters