andrewrk / node-s3-client

high level amazon s3 client for node.js
MIT License
1k stars 303 forks source link

NoSuchKey when trying to use client.moveObject #200

Open mexin opened 6 years ago

mexin commented 6 years ago

Im having trouble moving files using .moveObject... I have added the parameters like this, but still every time I get the same error message, file is indeed in the bucket as I use client.listObjects(params) to get the Key and send it to client.moveObject(params) CopySource

const params = {
        Bucket: 'bucket-name',
        CopySource: `bucket-name/${fileKey}`,
        Key: fileKey.replace(oldPrefix, newPrefix),
    };
    const moveFile = client.moveObject(params);

** Editted My files had "+" on them so I had to use encodeURIComponent() and that seems to solved it, now Im getting MethodNotAllowed: The specified method is not allowed against this resource. which seems its due client.deleteObject() did I miss anything?

Thanks