Skip to content

Commit 4e81079

Browse files
committed
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 <[email protected]>
1 parent 3dc4011 commit 4e81079

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/response.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ function actionPDF (req, res, note) {
320320
res.setHeader('Content-Type', 'application/pdf; charset=UTF-8')
321321
res.setHeader('X-Robots-Tag', 'noindex, nofollow') // prevent crawling
322322
stream.pipe(res)
323-
fs.unlink(path)
323+
fs.unlinkSync(path)
324324
})
325325
}
326326

0 commit comments

Comments
 (0)