surma/s3put

Problem with quotes and space in filename

Closed this issue · 1 comments

Hi there,

During export from S3 to local filesystem there is a problem with files contains space and single/double quotes:

./s3put -c 5 --continue s3 -k XXX -s XXXXX -b https://s3-us-west-2.amazonaws.com/bucket-name get bucket-name/ 
2014/11/01 10:38:28 Starting 5 goroutines...
2014/11/01 10:38:29 Transfering (Prefix: ) blog/...
2014/11/01 10:38:29 Could not transfer (Prefix: ) blog/: open bucket-name/blog: is a directory
2014/11/01 10:38:30 Transfering (Prefix: ) blog/filename.png...
2014/11/01 10:38:30 Transfer of (Prefix: ) blog/filename.png done
2014/11/01 10:38:31 Could not receive {blog/file name.png 2014-04-09T18:23:43.000Z %!s(int64=767527) "xxxcontrol_sumxxx" STANDARD {xxxxxxxxxx user}}: The request signature we calculated does not match the signature you provided. Check your key and signing method.
...
2014/11/01 12:10:08 Could not receive {dir/file's-choice-ben-"believer-burst"_1.JPG 2014-10-27T13:46:12.000Z %!s(int64=797308) "xxxcontrol_sumxxx" STANDARD {xxxxxxxxx user}}: The request signature we calculated does not match the signature you provided. Check your key and signing method.

Sorry for taking so long, finally found some time to take a look at this.

I can reproduce your issue (a space in the key alone is sufficient to reproduce the error). It seems like the request signature for the S3 API is calculated wrong if there’s some unusual character in the key.

That bad news is, that I can only refer you to go-amz, because it seems to be a problem with their library (which I am using). I am using Bucket.List() to get a list of keys in a bucket and pass those keys directly to Bucket.GetReader(). I would like to ask you to open up an issue upstream.