shrinerb / shrine

File Attachment toolkit for Ruby applications

Home Page:https://shrinerb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using download_endpoint with content-disposition

kobius opened this issue · comments

commented

I'm using Shrine for all of the images in my app - all of which are shown inline, however I want one image and one derivation to use response-content-disposition=attachment for images on S3, rendered via Cloudfront.

Is it possible to set the content-disposition via the URL:

model.image_file(:thumbnail, disposition: "attachment").download_url
model.image_file(disposition: "attachment").download_url

Fortunately found some help via #1391 but I still haven't figured out how to generate the correct header for images via download_endpoint.

The discussion forum is preferred for questions. You may have noticed in the template when you clicked New Issue:

- Issues are for bug reports only.
- Have a question or unsure if it's a bug, then please inquire on the [forum](https://discourse.shrinerb.com).

The download endpoint doesn't currently support per URL content disposition settings, you can only globally configure whether you want inline or attachment (and you cannot control the download filename). I would like to support this at some point, I believe it wouldn't require signing like derivation endpoint has. For now, I'd recommend implementing your own download endpoint using the rack_response plugin (which download_endpoint uses internally).

As @jrochkind said, GitHub issues should only be used for bug reports, so I'll close this.