diff options
author | Christoph (Sheogorath) Kern | 2018-09-24 20:34:29 +0200 |
---|---|---|
committer | GitHub | 2018-09-24 20:34:29 +0200 |
commit | 9e4d16566302e12ea529c733867009a0cd6edd7f (patch) | |
tree | e727c24424aeb34d6e83e7e92c20b5b6ce9f0f25 /lib | |
parent | 32afa1437510fb55194c9532fced856f9a496eb0 (diff) | |
parent | 6fdb9eea4627fe23e24d487d0b855493178b8798 (diff) |
Merge pull request #963 from SISheogorath/fix/crashPDF
Fix server crash on PDF creation
Diffstat (limited to '')
-rw-r--r-- | lib/response.js | 4 |
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 |