uppy-s3_multipart 0.3.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +35 -23
- data/lib/uppy/s3_multipart/app.rb +33 -3
- data/uppy-s3_multipart.gemspec +3 -2
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92f5e8ea76379a4e2a6e05a4bbe95b1e0f4b30aefb76a00073e1e059666e5aac
|
4
|
+
data.tar.gz: c3a1f4b4147311314c0c467ce56ffb0dfbd43dcd3eabbd907670783d645d8cc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da31cb0732d04bd750905329c67f91ffccea0d6fb988f9d488812f2dcc06266c3ea31578322cfa646b0dbe01f56dca69a97084fe175e7749dba56f1b42d5e25b
|
7
|
+
data.tar.gz: 8a85c20e8195c1d58de393b9e8d7a0957640fd56d02b860dd71e13205581f4221884c66ed2ae39b40235b246df5b8c9781dec3c307907be8709709408155e295
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# uppy-s3_multipart
|
2
2
|
|
3
3
|
Provides a Rack application that implements endpoints for the [aws-s3-multipart]
|
4
4
|
Uppy plugin. This enables multipart uploads directly to S3, which is
|
@@ -10,7 +10,7 @@ uploads.
|
|
10
10
|
Add the gem to your Gemfile:
|
11
11
|
|
12
12
|
```rb
|
13
|
-
gem "uppy-s3_multipart", "~> 0
|
13
|
+
gem "uppy-s3_multipart", "~> 1.0"
|
14
14
|
```
|
15
15
|
|
16
16
|
## Setup
|
@@ -20,27 +20,39 @@ the bucket's CORS configuration. In the AWS S3 Console go to your bucket, click
|
|
20
20
|
on "Permissions" tab and then on "CORS configuration". There paste in the
|
21
21
|
following:
|
22
22
|
|
23
|
-
```
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
23
|
+
```json
|
24
|
+
[
|
25
|
+
{
|
26
|
+
"AllowedHeaders": [
|
27
|
+
"content-type",
|
28
|
+
"x-amz-content-sha256",
|
29
|
+
"x-amz-date"
|
30
|
+
],
|
31
|
+
"AllowedMethods": [
|
32
|
+
"GET",
|
33
|
+
"POST",
|
34
|
+
"PUT"
|
35
|
+
],
|
36
|
+
"AllowedOrigins": [
|
37
|
+
"https://my-app.com"
|
38
|
+
],
|
39
|
+
"ExposeHeaders": [
|
40
|
+
"ETag"
|
41
|
+
],
|
42
|
+
"MaxAgeSeconds": 3000
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"AllowedHeaders": [],
|
46
|
+
"AllowedMethods": [
|
47
|
+
"GET"
|
48
|
+
],
|
49
|
+
"AllowedOrigins": [
|
50
|
+
"*"
|
51
|
+
],
|
52
|
+
"ExposeHeaders": [],
|
53
|
+
"MaxAgeSeconds": 3000
|
54
|
+
}
|
55
|
+
]
|
44
56
|
```
|
45
57
|
|
46
58
|
Replace `https://my-app.com` with the URL to your app (in development you can
|
@@ -54,6 +54,16 @@ module Uppy
|
|
54
54
|
{ uploadId: result.fetch(:upload_id), key: result.fetch(:key) }
|
55
55
|
end
|
56
56
|
|
57
|
+
# OPTIONS /s3/multipart
|
58
|
+
r.options ["", true] do
|
59
|
+
r.halt 204
|
60
|
+
end
|
61
|
+
|
62
|
+
# OPTIONS /s3/multipart/:uploadId/:partNumber
|
63
|
+
r.options String, String do |upload_id, part_number|
|
64
|
+
r.halt 204
|
65
|
+
end
|
66
|
+
|
57
67
|
# GET /s3/multipart/:uploadId
|
58
68
|
r.get String do |upload_id|
|
59
69
|
key = param!("key")
|
@@ -65,6 +75,19 @@ module Uppy
|
|
65
75
|
end
|
66
76
|
end
|
67
77
|
|
78
|
+
# GET /s3/multipart/:uploadId/batch
|
79
|
+
r.get String, "batch" do |upload_id|
|
80
|
+
key = param!("key")
|
81
|
+
part_numbers = param!("partNumbers").split(",")
|
82
|
+
|
83
|
+
batch = part_numbers.map do |part_number|
|
84
|
+
result = client_call(:prepare_upload_part, upload_id: upload_id, key: key, part_number: part_number)
|
85
|
+
[part_number, result.fetch(:url)]
|
86
|
+
end.to_h
|
87
|
+
|
88
|
+
{ presignedUrls: batch }
|
89
|
+
end
|
90
|
+
|
68
91
|
# GET /s3/multipart/:uploadId/:partNumber
|
69
92
|
r.get String, String do |upload_id, part_number|
|
70
93
|
key = param!("key")
|
@@ -98,7 +121,14 @@ module Uppy
|
|
98
121
|
r.delete String do |upload_id|
|
99
122
|
key = param!("key")
|
100
123
|
|
101
|
-
|
124
|
+
begin
|
125
|
+
client_call(:abort_multipart_upload, upload_id: upload_id, key: key)
|
126
|
+
rescue Aws::S3::Errors::NoSuchUpload
|
127
|
+
error!(
|
128
|
+
"Upload doesn't exist for \"key\" parameter",
|
129
|
+
status: 404
|
130
|
+
)
|
131
|
+
end
|
102
132
|
|
103
133
|
{}
|
104
134
|
end
|
@@ -123,8 +153,8 @@ module Uppy
|
|
123
153
|
value
|
124
154
|
end
|
125
155
|
|
126
|
-
def error!(message)
|
127
|
-
request.halt
|
156
|
+
def error!(message, status: 400)
|
157
|
+
request.halt status, { error: message }
|
128
158
|
end
|
129
159
|
end
|
130
160
|
end
|
data/uppy-s3_multipart.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "uppy-s3_multipart"
|
3
|
-
gem.version = "
|
3
|
+
gem.version = "1.2.0"
|
4
4
|
|
5
|
-
gem.required_ruby_version = ">= 2.
|
5
|
+
gem.required_ruby_version = ">= 2.3"
|
6
6
|
|
7
7
|
gem.summary = "Provides a Rack application that implements endpoints for the AwsS3Multipart Uppy plugin."
|
8
8
|
gem.homepage = "https://github.com/janko/uppy-s3_multipart"
|
@@ -23,4 +23,5 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_development_dependency "shrine", "~> 2.13"
|
24
24
|
gem.add_development_dependency "shrine-memory"
|
25
25
|
gem.add_development_dependency "aws-sdk-core", "~> 3.23"
|
26
|
+
gem.add_development_dependency "rexml"
|
26
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uppy-s3_multipart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: roda
|
@@ -142,7 +142,21 @@ dependencies:
|
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '3.23'
|
145
|
-
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: rexml
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
description:
|
146
160
|
email:
|
147
161
|
- janko.marohnic@gmail.com
|
148
162
|
executables: []
|
@@ -161,7 +175,7 @@ homepage: https://github.com/janko/uppy-s3_multipart
|
|
161
175
|
licenses:
|
162
176
|
- MIT
|
163
177
|
metadata: {}
|
164
|
-
post_install_message:
|
178
|
+
post_install_message:
|
165
179
|
rdoc_options: []
|
166
180
|
require_paths:
|
167
181
|
- lib
|
@@ -169,15 +183,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
183
|
requirements:
|
170
184
|
- - ">="
|
171
185
|
- !ruby/object:Gem::Version
|
172
|
-
version: '2.
|
186
|
+
version: '2.3'
|
173
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
188
|
requirements:
|
175
189
|
- - ">="
|
176
190
|
- !ruby/object:Gem::Version
|
177
191
|
version: '0'
|
178
192
|
requirements: []
|
179
|
-
rubygems_version: 3.
|
180
|
-
signing_key:
|
193
|
+
rubygems_version: 3.2.15
|
194
|
+
signing_key:
|
181
195
|
specification_version: 4
|
182
196
|
summary: Provides a Rack application that implements endpoints for the AwsS3Multipart
|
183
197
|
Uppy plugin.
|