aws

http://status.aws.amazon.com/ https://www.expeditedssl.com/aws-in-plain-english
mlimotte 2021-04-06T17:21:52.025800Z

Hi. I’m using the aws-api to upload a file to S3, and I want to set the Content-Type. I converted a java example I found to roughly this code:

(let [md       {"content-type" "text/plain"}
      response (core/throw-on-error
                 (aws/invoke client
                             {:op      :PutObject
                              :request {:Bucket   "<http://company.co|company.co>"
                                        :Key      "marc/foo2.txt"
                                        :Body     (-&gt; "some text" (.getBytes "UTF-8") (ByteArrayInputStream.))
                                        :Metadata md}}))]
  (:Body response))
But this is not working. When I check out the newly uploaded file in Amazon, I see: • System defined, Content-Type , application/octet-stream • User defined, x-amz-meta-content-type, text/plain So, instead of setting the system defined “Content-Type”, it stuffed my value into x-amz-meta-content-type . Any suggestions?

ghadi 2021-04-06T17:28:09.026400Z

(aws/doc client :PutObject) call that @mlimotte and check out the :ContentType option

ghadi 2021-04-06T17:28:30.026900Z

content type might be special in that it won't appear in Metadata

mlimotte 2021-04-06T19:27:54.027600Z

@ghadi Yep--- that resolved the issue. Was not aware of that divergence from the java sdk. Thanks.

ghadi 2021-04-06T19:28:38.028300Z

aws-api is generated from descriptor files, which is similar to how the java v2 sdk is generated (but java v1 sdk is ad hoc)