Skip to content
This repository was archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
FIX copy with versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas2bert committed Apr 6, 2017
1 parent f44351c commit 7e532cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/api/objectCopy.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function objectCopy(authInfo, request, sourceBucket,
authInfo,
bucketName: sourceBucket,
objectKey: sourceObject,
versionId: sourceVersionId,
requestType: 'objectGet',
};
const valPutParams = {
Expand Down
10 changes: 7 additions & 3 deletions tests/functional/aws-node-sdk/test/versioning/objectCopy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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([
Expand All @@ -113,7 +116,7 @@ testing('Object Version Copy', () => {
s3.copyObject(Object.assign({
Bucket: destBucketName,
Key: destObjName,
CopySource: `${sourceBucketName}/${sourceObjName}`,
CopySource: copySource,
}, fields), cb);
}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 7e532cf

Please sign in to comment.