copyObject is returning /tmp/buckets//<bucket_name>/key
jcald1 opened this issue · comments
I'm running v 4.0.1
copyObject is returning /tmp/buckets//<bucket_name>/key
Code:
const copyObject = s3 => sourceBucket => outputBucket => ( oldKey, newKey) => {
const CopySource = `/${sourceBucket}/${oldKey}`;
const params = {
Bucket : outputBucket,
CopySource,
Key : newKey
};
return s3.copyObject(params).promise();
test file:
const AWSMock = require('mock-aws-s3');
AWSMock.config.basePath = '/tmp/buckets';
const FAKE_S3 = AWSMock.S3({
params : {
Bucket : KNOWN_OUTPUT_BUCKET
}
}),
FAKE_OLD_KEY = 'oldkey',
FAKE_NEW_KEY = 'newkey',
FAKE_BODY = '123';
copyObject(FAKE_S3)(KNOWN_OUTPUT_BUCKET)(KNOWN_OUTPUT_BUCKET)(FAKE_OLD_KEY, FAKE_NEW_KEY)
.then(res => {
console.log('res',res)
Output:
res {
Bucket: '/tmp/buckets/media-output-dev-use1-v1',
CopySource: '/tmp/buckets//media-output-dev-use1-v1/oldkey',
Key: 'newkey'
}