mirror of
https://github.com/status-im/codimd.git
synced 2025-01-12 10:35:08 +00:00
Merge pull request #1421 from hackmdio/fix/cannot-download-pdf
Fix server crash when download pdf twice
This commit is contained in:
commit
e33bafd35d
@ -95,9 +95,12 @@ function actionPDF (req, res, note) {
|
||||
res.setHeader('Cache-Control', 'private')
|
||||
res.setHeader('Content-Type', 'application/pdf; charset=UTF-8')
|
||||
res.setHeader('X-Robots-Tag', 'noindex, nofollow') // prevent crawling
|
||||
stream.pipe(res)
|
||||
stream.on('end', () => {
|
||||
stream.close()
|
||||
fs.unlinkSync(pdfPath)
|
||||
})
|
||||
stream.pipe(res)
|
||||
})
|
||||
}
|
||||
|
||||
const outputFormats = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user