jcberquist / aws-cfml

Lucee/ColdFusion library for interacting with AWS API's
MIT License
72 stars 53 forks source link

Presigned url headers #70

Closed Daemach closed 1 year ago

Daemach commented 1 year ago

I needed to force the browser to download a presigned URL rather than open it. Adding headers solved the problem.

jcberquist commented 1 year ago

This looks useful, thank you! Could you clean this up to remove the extra changes that do not pertain to this pull request? Also, I would prefer that the new argument be called queryParams rather than headers, since it will put whatever you add into the query string whether it prompts a header override or not.

As a side note you have the following comment:

headers = { "response-content-type": "application/octet-stream" } is useful for forcing a download

In my experience the header that suggests to the browser that it download vs open inline is the Content-Disposition header. From the examples there:

Content-Disposition: attachment; filename="cool.html"

tells the browser to download the file, and suggests a filename for the file. So you would use:

queryParams = { "response-content-disposition": "attachment" } is useful for forcing a download
Daemach commented 1 year ago

@jcberquist Done! Thanks for the advice.

jcberquist commented 1 year ago

Thanks! I cleaned things up a bit before merging.