tus-server 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9ba14174a689878aa1224bdb2e526d869b888dc85164ec3e9320c8a171bcd73
4
- data.tar.gz: 61e227c29273bd00007a96522a16b5f470fc433741999b072bf1c3642e13289b
3
+ metadata.gz: 316f557990315ae072a266cb92bd5acdf4a5e930f734fc7886cb8c2cc2ec2eb3
4
+ data.tar.gz: a98df5216aa495f2f18bad0f61b2ed7797f714139991f700fdb403b94abd0271
5
5
  SHA512:
6
- metadata.gz: a4914ab70cda026beee4de2b830778e43ef32131ddb65f470086d5cfd036f9dd046fafb09deced577d64965d539bf08a24ec44b810a77052822efde595610b04
7
- data.tar.gz: 3c3f0d9196654541f5ebee297130c3d216dc1948a8a5c29695dc3251d969af85a101b0e249a889ec140e8f837c1fba1269a977649926d537c02dd5cd249d4e14
6
+ metadata.gz: '02662191fa1b2e8df42bbba1a5f32d1b70ae3623cc89736ad4bbaa4c46cbc97364c0c4edd3c5fdfc348611bbca76132e7c71d6c785e953aa6f556f986755680b'
7
+ data.tar.gz: 6ac96ebc6710e231dabaa66faf8fced5fbf80faceb12f4992f3afa2235d4908f40649f00e794e0923a2311f0ee91ed2f4df0e7adf8c19321f1554f451010d2f8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.2.1 (2018-12-19)
2
+
3
+ * Use `content_disposition` gem to generate `Content-Disposition` in download endpoint (@janko-m)
4
+
1
5
  ## 2.2.0 (2018-12-02)
2
6
 
3
7
  * Add `before_create`, `after_create`, `after_finish`, and `after_terminate` hooks (@janko-m)
data/README.md CHANGED
@@ -227,7 +227,7 @@ to `:redirect_download`, which will then be evaluated in the context of the
227
227
 
228
228
  ```rb
229
229
  Tus::Server.opts[:redirect_download] = -> (uid, info, **options) do
230
- storage.file_url(uid, info, response_expires: 10, **options) # link expires after 10 seconds
230
+ storage.file_url(uid, info, expires_in: 10, **options) # link expires after 10 seconds
231
231
  end
232
232
  ```
233
233
 
@@ -242,7 +242,7 @@ You can also specify additional options that will be fowarded to
242
242
  [`Aws::S3::Client#create_multipart_upload`] using `:upload_options`.
243
243
 
244
244
  ```rb
245
- Tus::Storage::S3.new(upload_options: {content_disposition: "attachment"}, **options)
245
+ Tus::Storage::S3.new(upload_options: { content_disposition: "attachment" }, **options)
246
246
  ```
247
247
 
248
248
  All other options will be forwarded to [`Aws::S3::Client#initialize`], so you
data/lib/tus/server.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
3
  require "roda"
4
+ require "rack/rewindable_input"
4
5
 
5
6
  require "tus/storage/filesystem"
6
7
  require "tus/info"
@@ -8,11 +9,11 @@ require "tus/input"
8
9
  require "tus/checksum"
9
10
  require "tus/errors"
10
11
 
12
+ require "content_disposition"
13
+
11
14
  require "securerandom"
12
15
  require "time"
13
16
 
14
- require "rack/rewindable_input"
15
-
16
17
  module Tus
17
18
  class Server < Roda
18
19
  SUPPORTED_VERSIONS = ["1.0.0"]
@@ -188,9 +189,8 @@ module Tus
188
189
  name = metadata["name"] || metadata["filename"]
189
190
  type = metadata["type"] || metadata["content_type"]
190
191
 
191
- content_disposition = opts[:disposition]
192
- content_disposition += "; filename=\"#{name}\"" if name
193
- content_type = type || "application/octet-stream"
192
+ content_disposition = ContentDisposition.(disposition: opts[:disposition], filename: name)
193
+ content_type = type || "application/octet-stream"
194
194
 
195
195
  if redirect_download
196
196
  redirect_url = instance_exec(uid, info.to_h,
data/tus-server.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "tus-server"
3
- gem.version = "2.2.0"
3
+ gem.version = "2.2.1"
4
4
 
5
5
  gem.required_ruby_version = ">= 2.3"
6
6
 
@@ -15,11 +15,12 @@ Gem::Specification.new do |gem|
15
15
  gem.require_path = "lib"
16
16
 
17
17
  gem.add_dependency "roda", ">= 2.27", "< 4"
18
+ gem.add_dependency "content_disposition", "~> 1.0"
18
19
 
19
20
  gem.add_development_dependency "rake", "~> 11.1"
20
21
  gem.add_development_dependency "minitest", "~> 5.8"
21
22
  gem.add_development_dependency "rack-test_app"
22
- gem.add_development_dependency "cucumber"
23
+ gem.add_development_dependency "cucumber", "~> 3.1"
23
24
  gem.add_development_dependency "mongo"
24
25
  gem.add_development_dependency "aws-sdk-s3", "~> 1.2"
25
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tus-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-02 00:00:00.000000000 Z
11
+ date: 2018-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roda
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '4'
33
+ - !ruby/object:Gem::Dependency
34
+ name: content_disposition
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: rake
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -76,16 +90,16 @@ dependencies:
76
90
  name: cucumber
77
91
  requirement: !ruby/object:Gem::Requirement
78
92
  requirements:
79
- - - ">="
93
+ - - "~>"
80
94
  - !ruby/object:Gem::Version
81
- version: '0'
95
+ version: '3.1'
82
96
  type: :development
83
97
  prerelease: false
84
98
  version_requirements: !ruby/object:Gem::Requirement
85
99
  requirements:
86
- - - ">="
100
+ - - "~>"
87
101
  - !ruby/object:Gem::Version
88
- version: '0'
102
+ version: '3.1'
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: mongo
91
105
  requirement: !ruby/object:Gem::Requirement