diff --git a/services/web/app/src/Features/Compile/CompileController.js b/services/web/app/src/Features/Compile/CompileController.js index 7d3916a7a5..1f4b512598 100644 --- a/services/web/app/src/Features/Compile/CompileController.js +++ b/services/web/app/src/Features/Compile/CompileController.js @@ -100,7 +100,7 @@ module.exports = CompileController = { 'zonal-clsi-lb-downloads', {}, (_err, assignment) => { - if (assignment?.variant !== 'zonal') { + if (assignment?.variant !== 'zonal' && Array.isArray(outputFiles)) { outputFiles.forEach(file => { file.url = file.url.replace(/^\/zone\/\w/, '') }) diff --git a/services/web/test/unit/src/Compile/CompileControllerTests.js b/services/web/test/unit/src/Compile/CompileControllerTests.js index f69aead526..9c8ad93d0e 100644 --- a/services/web/test/unit/src/Compile/CompileControllerTests.js +++ b/services/web/test/unit/src/Compile/CompileControllerTests.js @@ -101,6 +101,31 @@ describe('CompileController', function () { }) describe('zonal downloads', function () { + describe('when in the default split test variant and not output files were returned', function () { + beforeEach(function () { + this.getAssignment.yields(null, { variant: 'default' }) + this.CompileManager.compile = sinon + .stub() + .callsArgWith( + 3, + null, + (this.status = 'success'), + (this.outputFiles = null) + ) + this.CompileController.compile(this.req, this.res, this.next) + }) + + it('should ignore the output files', function () { + this.res.statusCode.should.equal(200) + this.res.body.should.equal( + JSON.stringify({ + status: this.status, + outputFiles: null, + }) + ) + }) + }) + describe('when in the default split test variant', function () { beforeEach(function () { this.getAssignment.yields(null, { variant: 'default' })