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

s3 user-metadata is inconsistent #3

Closed
mthvedt opened this issue Apr 6, 2013 · 1 comment
Closed

s3 user-metadata is inconsistent #3

mthvedt opened this issue Apr 6, 2013 · 1 comment

Comments

@mthvedt
Copy link

mthvedt commented Apr 6, 2013

So Amazonica is a really slick library, particularly the bean-to-Clojure map mapping. I'm writing a s3sync utility that I hope will be more flexible/functional than the commonly used s3sync.rb. Being able to express things as Clojure maps makes things work really well, but user-metadata requires a workaround if you're updating metadata that you pulled from s3.

In particular, :user-metadata is a keyword -> String mapping when downloaded, but must be a String -> String mapping when uploaded.

Example below

user=> (amazonica.aws.s3/get-object-metadata my-credentials my-website "404.html")
{:content-length 6452, :last-modified #<DateTime 2013-04-04T13:21:30.000-05:00>, :content-type "text/html", :raw-metadata {:Content-Type "text/html", :Accept-Ranges "bytes", :Last-Modified #<DateTime 2013-04-04T13:21:30.000-05:00>, :Content-Length 6452, :ETag "2d477e36be6f149b4c559591a6201774"}, :etag "2d477e36be6f149b4c559591a6201774", :user-metadata {:foo "bar"}}

user=> (amazonica.aws.s3/copy-object my-credentials :source-bucket-name my-website :destination-bucket-name my-website :source-key "404.html" :destination-key "404.html" :new-object-metadata {:content-type "text/html" :user-metadata {:foo "bar"}})
ClassCastException clojure.lang.Keyword cannot be cast to java.lang.String  com.amazonaws.services.s3.AmazonS3Client.populateRequestMetadata (AmazonS3Client.java:2634)

user=> (amazonica.aws.s3/copy-object my-credentials :source-bucket-name my-website :destination-bucket-name my-website :source-key "404.html" :destination-key "404.html" :new-object-metadata {:content-type "text/html" :user-metadata {"foo" "bar"}})
{:etag "2d477e36be6f149b4c559591a6201774", :last-modified-date #<DateTime 2013-04-04T13:21:58.000-05:00>}
@mcohen01
Copy link
Owner

mcohen01 commented Apr 7, 2013

fixed in version 0.1.5

@mcohen01 mcohen01 closed this as completed Apr 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants