summaryrefslogtreecommitdiff
path: root/lib/response.js
diff options
context:
space:
mode:
authorSheogorath2019-01-18 22:51:01 +0100
committerSheogorath2019-01-24 13:02:53 +0100
commit4e81079050d2aae6b37819bcecec230a2ea4ee58 (patch)
treecb1f583e53fcc345418c96631dc9c44db3df1e67 /lib/response.js
parent3dc40116e4ce8b6eeba6dc1c972dac74b518cb46 (diff)
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 <sheogorath@shivering-isles.com>
Diffstat (limited to 'lib/response.js')
-rw-r--r--lib/response.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/response.js b/lib/response.js
index b94f473a..8191e74f 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)
})
}