diff --git a/lib/api/objectCopy.js b/lib/api/objectCopy.js index bafda65f6e..8f5d6a3ef9 100644 --- a/lib/api/objectCopy.js +++ b/lib/api/objectCopy.js @@ -122,6 +122,7 @@ function objectCopy(authInfo, request, sourceBucket, authInfo, bucketName: sourceBucket, objectKey: sourceObject, + versionId: sourceVersionId, requestType: 'objectGet', }; const valPutParams = { diff --git a/tests/functional/aws-node-sdk/test/versioning/objectCopy.js b/tests/functional/aws-node-sdk/test/versioning/objectCopy.js index ca2c5a9374..32ffda86e5 100644 --- a/tests/functional/aws-node-sdk/test/versioning/objectCopy.js +++ b/tests/functional/aws-node-sdk/test/versioning/objectCopy.js @@ -29,6 +29,7 @@ const newContentEncoding = 'gzip,aws-chunked'; const newExpires = new Date(); const content = 'I am the best content ever'; +const secondContent = 'I am the second best content ever'; const otherAccountBucketUtility = new BucketUtility('lisa', {}); const otherAccountS3 = otherAccountBucketUtility.s3; @@ -101,7 +102,9 @@ testing('Object Version Copy', () => { }); }).then(res => { lastModified = res.LastModified; - }) + }).then(() => s3.putObjectAsync({ Bucket: sourceBucketName, + Key: sourceObjName, + Body: secondContent })) ); afterEach(done => async.parallel([ @@ -113,7 +116,7 @@ testing('Object Version Copy', () => { s3.copyObject(Object.assign({ Bucket: destBucketName, Key: destObjName, - CopySource: `${sourceBucketName}/${sourceObjName}`, + CopySource: copySource, }, fields), cb); } @@ -681,7 +684,8 @@ testing('Object Version Copy', () => { 'source object and write permission on the destination ' + 'bucket to copy the object', done => { s3.putObjectAcl({ Bucket: sourceBucketName, - Key: sourceObjName, ACL: 'public-read' }, () => { + Key: sourceObjName, ACL: 'public-read', VersionId: + versionId }, () => { otherAccountS3.copyObject({ Bucket: otherAccountBucket, Key: otherAccountKey, CopySource: copySource,