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

Aws::S3::Object#copy_to with Hash as argument #963

Closed
yutamgit opened this issue Oct 16, 2015 · 2 comments
Closed

Aws::S3::Object#copy_to with Hash as argument #963

yutamgit opened this issue Oct 16, 2015 · 2 comments
Labels
guidance Question that needs advice or information.

Comments

@yutamgit
Copy link

Hi,

I was testing out all three ways of calling copy_to ({Aws::S3::Object}, Hash - with :bucket and :key, String - formatted like "target-bucket-name/target-key") with an additional argument of acl: "public-read".

It seems like copy_to with acl: "public-read" works when passing in an {Aws::S3::Object} and a String with the bucket name and target key. However, passing in options like (bucket: 'test-bucket', key: 'test-key', acl: "public-read") doesn't work because the method below bundles up the arguments into the target parameter and options stays empty.

def copy_to(target, options = {})
  ObjectCopier.new(self, options).copy_to(target, options)
end

The method works if we pass in two hashes ({bucket: 'test-bucket', key: 'test-key'}, {acl: "public-read"}) and I was wondering if that was the intended way of calling this method since I couldn't find anything in the documentation.

Thank you for your time!

@trevorrowe
Copy link
Member

The documented method signature is #copy_from(source, options = {}). The source param can be a String, Hash, or Aws::S3::Object. Yes, the implementation required you to pass two hashes if source was a hash.

I went ahead and added the ability to merge the options into the source/target hash.

@yutaison
Copy link

Thanks @trevorrowe !

awood45 added a commit that referenced this issue Oct 22, 2015
@srchase srchase added the guidance Question that needs advice or information. label Dec 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

4 participants