Bug #18355
openwhen call the multiparts upload API TransferManager.upload() by s3 java API , i got a excepiton 'AmazonS3Exception'
0%
Description
I fount that when the parameter in the URL incloudes characters '-,_.~', got excepiton 'AmazonS3Exception' , I looked at the s3 doc and thought the rgw's implement might be wrong.
the example code : http://docs.aws.amazon.com/AmazonS3/latest/dev/HLuploadFileJava.html
the s3 doc:
http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
URI-encode each parameter name and value according to the following rules:
Do not URI-encode any of the unreserved characters that RFC 3986 defines: A-Z, a-z, 0-9, hyphen ( - ), underscore ( _ ), period ( . ), and tilde ( ~ ).
Percent-encode all other characters with %XY, where X and Y are hexadecimal characters (0-9 and uppercase A-F). For example, the space character must be encoded as %20 (not using '+', as some encoding schemes do) and extended UTF-8 characters must be in the form %XY%ZA%BC.
Files
Updated by Matt Benjamin almost 7 years ago
- Status changed from New to In Progress
- Assignee set to Matt Benjamin
Updated by PL Garnier over 6 years ago
I ran into this today with a key containing '='.
I believe a simple call to url decoding is missing from multipart upload code: using boto3 in Python to duplicate a file fails, while using s3cmd works.
- boto3 uses multipart uploads to duplicate the file:
PUT /bucket/dst?uploadId=2~yhtGWWp2xEGmZCUoCVH5THPrNJKaRMp&partNumber=1 HTTP/1.1 Host: ceph-storage.example.com ... x-amz-copy-source: bucket/src-%3D
Response is a 404: NoSuchKey.
- s3cmd sends a PUT request:
PUT /dst HTTP/1.1 Host: bucket.ceph-storage.example.com ... x-amz-copy-source: /bucket/src-%3D
Response is 200 OK.