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
4 changes: 2 additions & 2 deletions app/src/controllers/bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const controller = {
log.warn(`Failure to validate bucket credentials: ${e.message}`, {
function: '_validateCredentials',
});
throw new Problem(409, {
throw new Problem(403, {
detail: 'Unable to validate supplied credentials for the bucket',
});
}
Expand Down Expand Up @@ -128,7 +128,7 @@ const controller = {
if (e instanceof UniqueViolationError) {
// Grant permissions if credentials precisely match
response = await bucketService.checkGrantPermissions(data).catch(permErr => {
next(new Problem(403, { detail: permErr.message, instance: req.originalUrl }));
next(new Problem(409, { detail: permErr.message, instance: req.originalUrl }));
});
} else {
next(errorToProblem(SERVICE, e));
Expand Down
3 changes: 2 additions & 1 deletion app/src/services/bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ const service = {
await bucketPermissionService.addPermissions(bucket.bucketId, perms, data.userId, trx);
}
} else {
throw new Error('Bucket credential mismatch');
throw new Error('The bucket already exists in COMS, but with different credentials. ' +
'Please contact your object storage server admin, or whoever added the bucket first.');
}

if (!etrx) await trx.commit();
Expand Down
4 changes: 2 additions & 2 deletions app/tests/unit/controllers/bucket.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ describe('createBucketChild', () => {
}));
});

it('should return a 409 when bucket can not be validated', async () => {
it('should return a 403 when bucket can not be validated', async () => {
const req = {
body: { bucketName: 'bucketName', subKey: 'subKey' },
currentUser: CURRENT_USER,
Expand Down Expand Up @@ -404,7 +404,7 @@ describe('createBucketChild', () => {
}));

expect(next).toHaveBeenCalledTimes(1);
expect(next).toHaveBeenCalledWith(new Problem(409, {
expect(next).toHaveBeenCalledWith(new Problem(403, {
detail: 'Unable to validate supplied credentials for the bucket'
}));
});
Expand Down
Loading