Skip to content

Commit 59ee1fa

Browse files
committed
✨ skip logic if versionId is defined (update a specific version)
Issue: CLDSRV-632
1 parent 2679059 commit 59ee1fa

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/routes/routeBackbeat.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,11 @@ function putMetadata(request, response, bucketInfo, objMd, log, callback) {
652652
});
653653
},
654654
next => {
655-
versioningPreprocessing(bucketName, bucketInfo, objectKey, objMd, log, next);
655+
if (!versionId) {
656+
return next();
657+
}
658+
659+
return versioningPreprocessing(bucketName, bucketInfo, objectKey, objMd, log, next);
656660
},
657661
next => {
658662
log.trace('putting object version', {

tests/unit/routes/routeBackbeat.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,7 @@ describe('routeBackbeat', () => {
293293

294294
it('should handle error when putting metadata', async () => {
295295
const putObjectMDStub = sandbox.stub(metadata, 'putObjectMD');
296-
putObjectMDStub.onCall(0).callsFake(
297-
(_bucketName, _objectKey, _omVal, _options, _logParam, cb) => cb(null, {})
298-
);
299-
putObjectMDStub.onCall(1).callsFake((bucketName, objectKey, omVal, options, logParam, cb) => {
296+
putObjectMDStub.onCall(0).callsFake((bucketName, objectKey, omVal, options, logParam, cb) => {
300297
cb(new Error('error'));
301298
});
302299

0 commit comments

Comments
 (0)