Improve style of the "POST /s3/multipart" route

parent 9500cdb3
...@@ -38,17 +38,16 @@ module Uppy ...@@ -38,17 +38,16 @@ module Uppy
route do |r| route do |r|
# POST /s3/multipart # POST /s3/multipart
r.post ["", true] do r.post ["", true] do
content_type = r.params["type"] type = r.params["type"]
filename = r.params["filename"] filename = r.params["filename"]
extension = File.extname(filename.to_s) key = SecureRandom.hex + File.extname(filename.to_s)
key = SecureRandom.hex + extension key = [*opts[:prefix], key].join("/")
key = "#{opts[:prefix]}/#{key}" if opts[:prefix]
content_disposition = ContentDisposition.inline(filename) if filename options = {}
options[:content_type] = type if type
options = { content_type: content_type, content_disposition: content_disposition } options[:content_disposition] = ContentDisposition.inline(filename) if filename
options[:acl] = "public-read" if opts[:public] options[:acl] = "public-read" if opts[:public]
result = client_call(:create_multipart_upload, key: key, **options) result = client_call(:create_multipart_upload, key: key, **options)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment