diff --git a/lib/resources/config.js b/lib/resources/config.js index 27eeefff9..76b4613bc 100644 --- a/lib/resources/config.js +++ b/lib/resources/config.js @@ -63,7 +63,7 @@ module.exports = (service, endpoint, anonymousEndpoint) => { // Configs that store blobs const blob = await Blobs.getById(config.blobId).then(getOrNotFound); - return blobResponse(s3, key, blob, true); + return blobResponse(s3, key, blob); }; service.get('/config/public/:key', anonymousEndpoint(async (container, { params }) => { diff --git a/test/integration/api/config.js b/test/integration/api/config.js index 3ec88e2c8..5454f23c2 100644 --- a/test/integration/api/config.js +++ b/test/integration/api/config.js @@ -62,29 +62,26 @@ describe('api: /config', () => { }); })); - it('should inline select image types', testService(async (service) => { - const asAlice = await service.login('alice'); - - await asAlice.post('/v1/config/logo') - .set('Content-Type', 'image/jpeg') - .send('testimage') - .expect(200); - await asAlice.get('/v1/config/logo') - .expect(200) - .then(({ headers }) => { - headers['content-disposition'].should.startWith('inline'); - }); + [ + 'image/jpeg', + 'image/svg+xml', + 'text/html', + 'text/javascript', + ].forEach(mimeType => { + it(`should not set Content-Disposition: inline for mime type: ${mimeType}`, testService(async (service) => { + const asAlice = await service.login('alice'); - await asAlice.post('/v1/config/logo') - .set('Content-Type', 'image/svg+xml') - .send('testimage2') - .expect(200); - await asAlice.get('/v1/config/logo') - .expect(200) - .then(({ headers }) => { - headers['content-disposition'].should.startWith('attachment'); - }); - })); + await asAlice.post('/v1/config/logo') + .set('Content-Type', mimeType) + .send('testimage') + .expect(200); + await asAlice.get('/v1/config/logo') + .expect(200) + .then(({ headers }) => { + headers['content-disposition'].should.startWith('attachment'); + }); + })); + }); }); it('should overwrite the existing config', testService((service) =>