scireum / s3ninja

S3 ninja emulates the Amazon S3 API for developement and test purposes
MIT License
493 stars 91 forks source link

Copy from S3 to S3 fails #230

Closed gerhardj-b closed 1 year ago

gerhardj-b commented 1 year ago

When specifying a copy source which is a location in an S3 Bucket, the Operation cuts of the first character from the Bucket name.

Example with the official cli:

root@docker-desktop:/$ aws s3 --endpoint-url http://$MY_S3_NINJA cp s3://testbucket/testfile s3://testbucket/newtestfile
copy failed: s3://testbucket/testfile to s3://testbucket/newtestfile An error occurred (NoSuchBucket) when calling the CopyObject operation: Source bucket 'estbucket' does not exist

I suspect the substring here to be the culprit.

Amazon API Documentation here

jakobvogel commented 1 year ago

Thanks for reporting this, @gerhardj-b – Apparently, the aws CLI sends the copy header without leading path delimiter while the Java library does. (The new test cases are thus a bit pointless.)

gerhardj-b commented 1 year ago

Awesome, thanks. I read the API description also as not expecting a leading delimiter. Anyways, thanks for the extra check and solution for both cases.

jakobvogel commented 1 year ago

For internal reference: The original error is reproduced via with access credentials taken from http://localhost:9444/ui

$ aws configure --profile s3ninja
$ export AWS_PROFILE=s3ninja
$ aws s3 --endpoint-url http://localhost:9444 cp s3://bucket1/file1 s3://bucket2/file2.pdf
jakobvogel commented 1 year ago

Released with version 8.3.2