Merge pull request #6317 from overleaf/jpa-send-explicit-content-type
[web] send explicit content type in responses GitOrigin-RevId: d5aeaba57a7d2fc053fbf5adc2299fb46e435341
This commit is contained in:
@@ -17,6 +17,7 @@ const Metrics = require('@overleaf/metrics')
|
||||
const ProjectGetter = require('../Project/ProjectGetter')
|
||||
const ProjectZipStreamManager = require('./ProjectZipStreamManager')
|
||||
const DocumentUpdaterHandler = require('../DocumentUpdater/DocumentUpdaterHandler')
|
||||
const { prepareZipAttachment } = require('../../infrastructure/Response')
|
||||
|
||||
module.exports = ProjectDownloadsController = {
|
||||
downloadProject(req, res, next) {
|
||||
@@ -41,10 +42,7 @@ module.exports = ProjectDownloadsController = {
|
||||
if (error != null) {
|
||||
return next(error)
|
||||
}
|
||||
res.setContentDisposition('attachment', {
|
||||
filename: `${project.name}.zip`,
|
||||
})
|
||||
res.contentType('application/zip')
|
||||
prepareZipAttachment(res, `${project.name}.zip`)
|
||||
return stream.pipe(res)
|
||||
}
|
||||
)
|
||||
@@ -69,10 +67,10 @@ module.exports = ProjectDownloadsController = {
|
||||
if (error != null) {
|
||||
return next(error)
|
||||
}
|
||||
res.setContentDisposition('attachment', {
|
||||
filename: `Overleaf Projects (${project_ids.length} items).zip`,
|
||||
})
|
||||
res.contentType('application/zip')
|
||||
prepareZipAttachment(
|
||||
res,
|
||||
`Overleaf Projects (${project_ids.length} items).zip`
|
||||
)
|
||||
return stream.pipe(res)
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user