mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-10 22:50:46 +02:00
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:
@@ -46,8 +46,6 @@ describe('ProjectDownloadsController', function () {
|
||||
.stub()
|
||||
.callsArgWith(1, null, this.stream)
|
||||
this.req.params = { Project_id: this.project_id }
|
||||
this.res.contentType = sinon.stub()
|
||||
this.res.header = sinon.stub()
|
||||
this.project_name = 'project name with accênts'
|
||||
this.ProjectGetter.getProject = sinon
|
||||
.stub()
|
||||
@@ -92,9 +90,11 @@ describe('ProjectDownloadsController', function () {
|
||||
})
|
||||
|
||||
it('should name the downloaded file after the project', function () {
|
||||
return this.res.setContentDisposition
|
||||
.calledWith('attachment', { filename: `${this.project_name}.zip` })
|
||||
.should.equal(true)
|
||||
this.res.headers.should.deep.equal({
|
||||
'Content-Disposition': `attachment; filename="${this.project_name}.zip"`,
|
||||
'Content-Type': 'application/zip',
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
})
|
||||
})
|
||||
|
||||
it('should record the action via Metrics', function () {
|
||||
@@ -110,8 +110,6 @@ describe('ProjectDownloadsController', function () {
|
||||
.callsArgWith(1, null, this.stream)
|
||||
this.project_ids = ['project-1', 'project-2']
|
||||
this.req.query = { project_ids: this.project_ids.join(',') }
|
||||
this.res.contentType = sinon.stub()
|
||||
this.res.header = sinon.stub()
|
||||
this.DocumentUpdaterHandler.flushMultipleProjectsToMongo = sinon
|
||||
.stub()
|
||||
.callsArgWith(1)
|
||||
@@ -146,11 +144,12 @@ describe('ProjectDownloadsController', function () {
|
||||
})
|
||||
|
||||
it('should name the downloaded file after the project', function () {
|
||||
return this.res.setContentDisposition
|
||||
.calledWith('attachment', {
|
||||
filename: 'Overleaf Projects (2 items).zip',
|
||||
})
|
||||
.should.equal(true)
|
||||
this.res.headers.should.deep.equal({
|
||||
'Content-Disposition':
|
||||
'attachment; filename="Overleaf Projects (2 items).zip"',
|
||||
'Content-Type': 'application/zip',
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
})
|
||||
})
|
||||
|
||||
it('should record the action via Metrics', function () {
|
||||
|
||||
Reference in New Issue
Block a user