Merge pull request #8535 from overleaf/jpa-missing-return

[web] add a missing return statement from an error branch

GitOrigin-RevId: 282972cee23f6b426413ede0885695e386fc9352
This commit is contained in:
Jakob Ackermann 2022-06-23 16:05:58 +01:00 committed by Copybot
parent 50dd7a37f7
commit 4660029e38
2 changed files with 9 additions and 1 deletions

View file

@ -289,6 +289,7 @@ module.exports = CompileController = {
'something went wrong compile and downloading pdf'
)
res.sendStatus(500)
return
}
const url = `/project/${projectId}/output/output.pdf`
CompileController.proxyToClsi(projectId, url, req, res, next)

View file

@ -836,7 +836,7 @@ describe('CompileController', function () {
}
this.CompileManager.compile.callsArgWith(3)
this.CompileController.proxyToClsi = sinon.stub()
this.res = { send: () => {} }
this.res = { send: () => {}, sendStatus: sinon.stub() }
})
it('should call compile in the compile manager', function (done) {
@ -865,6 +865,13 @@ describe('CompileController', function () {
.should.equal(true)
done()
})
it('should not download anything on compilation failures', function () {
this.CompileManager.compile.yields(new Error('failed'))
this.CompileController.compileAndDownloadPdf(this.req, this.res)
this.res.sendStatus.should.have.been.calledWith(500)
this.CompileController.proxyToClsi.should.not.have.been.called
})
})
describe('wordCount', function () {