Skip to content
New issue

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

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

Already on GitHub? # to your account

obj.copy method does not parse acl argument #119

Open
Nitemaeric opened this issue Aug 15, 2016 · 2 comments
Open

obj.copy method does not parse acl argument #119

Nitemaeric opened this issue Aug 15, 2016 · 2 comments
Labels

Comments

@Nitemaeric
Copy link

So, after much confusion, seems that there is a bug with the "copy_object" method.

The documentation states that you can do:

object = bucket.objects.find("lenna.png")
object.copy(:key => "lenna.png", :bucket => bucket, :acl => :public_read)

But after digging around I found that the :acl => :public_read causes an InvalidArgument Error.

https://github.com/qoobaa/s3/blob/master/lib/s3/object.rb#L40 parses the acl attribute on the object for normal "saving", but for the copy method, https://github.com/qoobaa/s3/blob/master/lib/s3/object.rb#L159, this parsing is skipped, sending "public_read" to S3, which it doesn't allow. i.e. "_" instead of "-".

@qoobaa
Copy link
Owner

qoobaa commented Oct 19, 2016

Could you create a PR with a fix?

@qoobaa qoobaa added the bug label Oct 19, 2016
@yoeran
Copy link

yoeran commented Mar 31, 2017

I ran into this problem as well. My workaround is using the string public-read instead of the symbol :public_read

Example:

object = bucket.objects.find("lenna.png")
object.copy(:key => "lenna.png", :bucket => bucket, :acl => 'public-read')

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants