Skip to content

Commit 5cbe322

Browse files
committed
CLDSRV-909: Honor bypassMaxPutObjectSize flag on CopyObject size limit
1 parent be2daf0 commit 5cbe322

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

lib/api/objectCopy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ function objectCopy(authInfo, request, sourceBucket,
352352
return next(err, destBucketMD);
353353
}
354354
const sourceSize = parseInt(sourceObjMD['content-length'], 10);
355-
if (sourceSize > constants.maximumAllowedUploadSize) {
355+
if (sourceSize > constants.maximumAllowedUploadSize && !config.bypassMaxPutObjectSize) {
356356
log.debug('copy source object too large', { sourceSize });
357357
const err = errorInstances.InvalidRequest.customizeDescription(
358358
'The specified copy source is larger than the maximum ' +

tests/unit/api/objectCopy.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,4 +684,16 @@ describe('objectCopy source size limit', () => {
684684
done();
685685
});
686686
});
687+
688+
it('should allow CopyObject when source size exceeds the limit but bypass flag is set', done => {
689+
constants.maximumAllowedUploadSize = sourceSize - 1;
690+
config.bypassMaxPutObjectSize = true;
691+
const testObjectCopyRequest = _createObjectCopyRequest(destBucketName);
692+
objectCopy(authInfo, testObjectCopyRequest, sourceBucketName, objectKey,
693+
undefined, log, err => {
694+
config.bypassMaxPutObjectSize = false;
695+
assert.ifError(err);
696+
done();
697+
});
698+
});
687699
});

0 commit comments

Comments
 (0)