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

setting "Content-Dispoition": "attachment" ? #42

Open
jdkealy opened this issue Apr 21, 2017 · 4 comments
Open

setting "Content-Dispoition": "attachment" ? #42

jdkealy opened this issue Apr 21, 2017 · 4 comments

Comments

@jdkealy
Copy link

jdkealy commented Apr 21, 2017

Hi,

I've been trying for a few hours now to set the metadata "Content-Disposition": "attachment" in S3. I'm trying to enforce that all images / videos are downloaded when one navigates to them in s3. I can't seem to get this to work with either header-fn or with metadata. Do you have any suggestions on how to set this header for S3 objects? Thanks!

@jdkealy
Copy link
Author

jdkealy commented Apr 21, 2017

I've tried the following

(dissoc
   (s3b/sign-upload
    {:file-name "foobar.jpg"
     :mime-type "jpg"
     :Content-Disposition "attachment"
     :headers {:metadata {:Content-Disposition "attachment"}}
     
     
     }
    {:bucket "blabla"
     :aws-key "blabla"
     :aws-zone "us-east-1"
     :aws-secret-key "blabla"})
   :action 
   :api_key)

no luck... setting the content disposition then in CLJS throws the error that the params don't match the presigned url.

@danielcompton
Copy link
Collaborator

Have you seen this? 21bc14e

@jdkealy
Copy link
Author

jdkealy commented Apr 22, 2017

I'm not really using the pipeline functions so correct me if I'm wrong I should be able to do this?

(s3b/sign-upload
(assoc newp :metadata {:content-disposition "attachment"})
{:bucket "bucket"
:aws-key "abc"
:aws-zone "us-east-1"
:aws-secret-key "defg"})

and then add another form field for metadata on the cljs side of things ?

@jdkealy
Copy link
Author

jdkealy commented Apr 22, 2017

I've done the above on the CLJ side of things, then in cljs i have tried appending the params with :metadata {:content-disposition "attachment"} but get back from amazon:

Invalid according to Policy: Extra input fields: :metadata
Invalid according to Policy: Extra input fields: :content-disposition

I realized then I needed to assoc "metadata" instead of :metadata but still get

Invalid according to Policy: Extra input fields: content-disposition
Invalid according to Policy: Extra input fields: metadata

Still pretty confused :/

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