Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/resources/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment thread
alxndrsn marked this conversation as resolved.
Comment thread
alxndrsn marked this conversation as resolved.
};

service.get('/config/public/:key', anonymousEndpoint(async (container, { params }) => {
Expand Down
41 changes: 19 additions & 22 deletions test/integration/api/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Comment thread
alxndrsn marked this conversation as resolved.
'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) =>
Expand Down