From 4e81079050d2aae6b37819bcecec230a2ea4ee58 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Fri, 18 Jan 2019 22:51:01 +0100 Subject: [PATCH] Fix broken PDF export by wrong unlink call We used `fs.unlink()` to remove the pdf file after we send it out to the client. This breaks in Node 10, when no function as second parameter is supplied. This patches changes it to the `fs.unlinkSync` function that doesn't have this requirement and this way doesn't crash. Signed-off-by: Sheogorath --- lib/response.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/response.js b/lib/response.js index b94f473..8191e74 100644 --- a/lib/response.js +++ b/lib/response.js @@ -320,7 +320,7 @@ function actionPDF (req, res, note) { res.setHeader('Content-Type', 'application/pdf; charset=UTF-8') res.setHeader('X-Robots-Tag', 'noindex, nofollow') // prevent crawling stream.pipe(res) - fs.unlink(path) + fs.unlinkSync(path) }) }