Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource s3-2006-03-01 has an incorrect request element for Complete Multipart Upload #151

Closed
tatsuya6502 opened this issue Sep 18, 2013 · 4 comments
Labels
bug This issue is a bug.

Comments

@tatsuya6502
Copy link

Hi,

  • aws-sdk-php2 2.4.1
  • PHP 5.3.3

I found Aws\S3\Model\MultipartUpload\UploadBuilder's upload() function generates an invalid request element for Complete Multipart Upload.

According to the S3 API Reference (API Version 2006-03-01)(1), the top level XML element should be CompleteMultipartUpload. However upload() generates MultipartUpload instead. I ran into this problem while running the SDK against a S3 API compatible storage software.

(1) http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadComplete.html

I believe the resource file s3-2006-03-01.php has the wrong element:

https://github.com/aws/aws-sdk-php/blob/d332784fc6/src/Aws/S3/Resources/s3-2006-03-01.php#L119

        'CompleteMultipartUpload' => array(
            'httpMethod' => 'POST',
            'uri' => '/{Bucket}{/Key*}',
            ...

            'data' => array(
                'xmlRoot' => array(
                    'name' => 'MultipartUpload',
                    'namespaces' => array(
                        'http://s3.amazonaws.com/doc/2006-03-01/',

Could you please change it to CompleteMultipartUpload so that we can run the SDK against any S3 API compatible storage?

Thanks,

@jeremeamia
Copy link
Contributor

Interesting... we'll look into this. This does not cause an error with S3, but, like you have observed, it doesn't seem to match the docs.

@tatsuya6502
Copy link
Author

Thank you for looking into this. I checked AWS SDK for Java and Ruby, and found that they have been using CompleteMultipartUpload element from very beginning.

AWS SDK for Java, RequestXmlFactory.java, first commit on Nov 9,2010

xml.start("CompleteMultipartUpload");

AWS SDK for Ruby, s3/client.rb, first commit on Jul 14, 2011

req.body =
  "<CompleteMultipartUpload>#{parts_xml}</CompleteMultipartUpload>"

I have no idea why MultipartUpload does not cause an error with S3, but I would recommend to follow the API document and use CompleteMultipartUpload.

@tatsuya6502
Copy link
Author

Thank you! I'll give it a try.

@tatsuya6502
Copy link
Author

My colleague tried the latest SDK on the master branch against the S3 API compatible storage and found that multipart upload works now. Thanks a lot for working on the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants