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

Make S3 content disposition option dynamic #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ a `:prefix` in the storage configuration.
Tus::Storage::S3.new(prefix: "tus", **options)
```

You can also specify additional options that will be fowarded to
You can also specify additional options that will be forwarded to
[`Aws::S3::Client#create_multipart_upload`] using `:upload_options`.

```rb
Tus::Storage::S3.new(upload_options: { acl: "public-read" }, **options)
Tus::Storage::S3.new(upload_options: { acl: "public-read", disposition: "attachment" }, **options)
```

All other options will be forwarded to [`Aws::S3::Client#initialize`]:
Expand Down
3 changes: 2 additions & 1 deletion lib/tus/storage/s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def create_file(uid, info = {})

options = {}
options[:content_type] = tus_info.type if tus_info.type
options[:content_disposition] = ContentDisposition.inline(tus_info.name) if tus_info.name
options[:content_disposition] = ContentDisposition.(disposition: upload_options[:disposition] || "inline", filename: tus_info.name)
upload_options.delete(:disposition)
options.merge!(upload_options)

multipart_upload = object(uid).initiate_multipart_upload(options)
Expand Down