Skip to content

Commit d814f1e

Browse files
Fix double response on conditional batchDelete
Issue: CLDSRV-394
1 parent 9040626 commit d814f1e

2 files changed

Lines changed: 12 additions & 17 deletions

File tree

lib/routes/routeBackbeat.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ function handleTaggingOperation(request, response, type, dataStoreVersionId,
311311
const dataRetrievalInfo = {
312312
versionId: dataStoreVersionId,
313313
};
314-
return _respond(response, dataRetrievalInfo, log, callback);
314+
return response ? _respond(response, dataRetrievalInfo, log, callback) : callback();
315315
});
316316
}
317317

@@ -1135,17 +1135,16 @@ function _azureConditionalDelete(request, response, log, cb) {
11351135
}
11361136

11371137
function _putTagging(request, response, log, cb) {
1138-
return handleTaggingOperation(
1139-
request, response, 'Put', undefined, log, err => {
1140-
if (err) {
1141-
log.error('put tagging failed', {
1142-
method: '_putTagging',
1143-
error: err,
1144-
});
1145-
return cb(err);
1146-
}
1147-
return _respond(response, null, log, cb);
1148-
});
1138+
return handleTaggingOperation(request, null, 'Put', undefined, log, err => {
1139+
if (err) {
1140+
log.error('put tagging failed', {
1141+
method: '_putTagging',
1142+
error: err,
1143+
});
1144+
return cb(err);
1145+
}
1146+
return _respond(response, null, log, cb);
1147+
});
11491148
}
11501149

11511150
function _conditionalTagging(request, response, locations, log, cb) {

tests/multipleBackend/routes/routeBackbeat.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,8 +1650,6 @@ describe('backbeat routes', () => {
16501650
it('should PUT tags for a non-versioned bucket', function test(done) {
16511651
this.timeout(10000);
16521652
const bucket = NONVERSIONED_BUCKET;
1653-
const awsBucket =
1654-
config.locationConstraints[awsLocation].details.bucketName;
16551653
const awsKey = uuidv4();
16561654
async.waterfall([
16571655
next =>
@@ -2337,9 +2335,7 @@ describe('backbeat routes', () => {
23372335

23382336
// The ceph image does not support putting tags during initiate MPU.
23392337
itSkipCeph('should put tags if the source is AWS and tags are ' +
2340-
'provided when initiating the multipart upload', done => {
2341-
const awsBucket =
2342-
config.locationConstraints[awsLocation].details.bucketName;
2338+
'provided when initiating the multipart upload', done => {
23432339
const awsKey = uuidv4();
23442340
const multipleBackendPath =
23452341
`/_/backbeat/multiplebackenddata/${awsBucket}/${awsKey}`;

0 commit comments

Comments
 (0)