Skip to content

Commit 6f16645

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

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
@@ -659,6 +659,7 @@ describe('objectCopy source size limit', () => {
659659

660660
after(() => {
661661
constants.maximumAllowedUploadSize = originalMaximumUploadSize;
662+
config.bypassMaxPutObjectSize = false;
662663
cleanup();
663664
});
664665

@@ -684,4 +685,15 @@ describe('objectCopy source size limit', () => {
684685
done();
685686
});
686687
});
688+
689+
it('should allow CopyObject when source size exceeds the limit but bypass flag is set', done => {
690+
constants.maximumAllowedUploadSize = sourceSize - 1;
691+
config.bypassMaxPutObjectSize = true;
692+
const testObjectCopyRequest = _createObjectCopyRequest(destBucketName);
693+
objectCopy(authInfo, testObjectCopyRequest, sourceBucketName, objectKey,
694+
undefined, log, err => {
695+
assert.ifError(err);
696+
done();
697+
});
698+
});
687699
});

0 commit comments

Comments
 (0)