shrine 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of shrine might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/doc/release_notes/3.2.2.md +14 -0
- data/lib/shrine/storage/s3.rb +27 -13
- data/lib/shrine/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26dd77c39f9d5b7cc4240eacea23823453959aad469acc1d86571f129c24c347
|
4
|
+
data.tar.gz: 9c25f9de3f8c8be835e096da01b47c0636e03158b423a306b89895de05ca4294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ae941f20c889d15300bb0a3bb522f8ad9f0cbd9bb80578246bc4d5ed37b1177ecc911172a405872919210bdaa05b1e67f23d77fc97d9c827ef85b01898dd336
|
7
|
+
data.tar.gz: 16fbafcc5d29e70f6d0d4a36fc2123a4a8f705345021b00e87c863826d73970a7bd8116aa19ad5c3a2a03763b0e5e435398ae15a21428d0b932c52a7bb648f8e
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
title: Shrine 3.2.2
|
3
|
+
---
|
4
|
+
|
5
|
+
## Bug fixes
|
6
|
+
|
7
|
+
* aws-sdk-core 3.104.0 introduced a backwards incompatible changes that caused
|
8
|
+
`Shrine::Storage::S3#open` to start raising an exception.
|
9
|
+
|
10
|
+
```
|
11
|
+
NoMethodError: undefined method `bytesize' for #<Array:0x000000000a721be0>
|
12
|
+
```
|
13
|
+
|
14
|
+
This has now been fixed.
|
data/lib/shrine/storage/s3.rb
CHANGED
@@ -103,7 +103,7 @@ class Shrine
|
|
103
103
|
#
|
104
104
|
# [`Aws::S3::Object#get`]: http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#get-instance_method
|
105
105
|
def open(id, rewindable: true, **options)
|
106
|
-
chunks, length =
|
106
|
+
chunks, length = get(object(id), options)
|
107
107
|
|
108
108
|
Down::ChunkedIO.new(chunks: chunks, rewindable: rewindable, size: length)
|
109
109
|
rescue Aws::S3::Errors::NoSuchKey
|
@@ -279,22 +279,36 @@ class Shrine
|
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
req = client.build_request(:get_object, bucket: bucket.name, key: object.key, **params)
|
282
|
+
if Gem::Version.new(Aws::CORE_GEM_VERSION) >= Gem::Version.new("3.104.0")
|
283
|
+
def get(object, params)
|
284
|
+
enum = object.enum_for(:get, **params)
|
286
285
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
286
|
+
begin
|
287
|
+
content_length = Integer(enum.peek.last["content-length"])
|
288
|
+
rescue StopIteration
|
289
|
+
content_length = 0
|
290
|
+
end
|
291
|
+
|
292
|
+
chunks = Enumerator.new { |y| loop { y << enum.next.first } }
|
293
|
+
|
294
|
+
[chunks, content_length]
|
292
295
|
end
|
296
|
+
else
|
297
|
+
def get(object, params)
|
298
|
+
req = client.build_request(:get_object, bucket: bucket.name, key: object.key, **params)
|
299
|
+
|
300
|
+
body = req.enum_for(:send_request)
|
301
|
+
begin
|
302
|
+
body.peek # start the request
|
303
|
+
rescue StopIteration
|
304
|
+
# the S3 object is empty
|
305
|
+
end
|
293
306
|
|
294
|
-
|
295
|
-
|
307
|
+
content_length = Integer(req.context.http_response.headers["Content-Length"])
|
308
|
+
chunks = Enumerator.new { |y| loop { y << body.next } }
|
296
309
|
|
297
|
-
|
310
|
+
[chunks, content_length]
|
311
|
+
end
|
298
312
|
end
|
299
313
|
|
300
314
|
# The file is copyable if it's on S3 and on the same Amazon account.
|
data/lib/shrine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shrine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: down
|
@@ -457,6 +457,7 @@ files:
|
|
457
457
|
- doc/release_notes/3.1.0.md
|
458
458
|
- doc/release_notes/3.2.0.md
|
459
459
|
- doc/release_notes/3.2.1.md
|
460
|
+
- doc/release_notes/3.2.2.md
|
460
461
|
- doc/retrieving_uploads.md
|
461
462
|
- doc/securing_uploads.md
|
462
463
|
- doc/storage/file_system.md
|
@@ -551,7 +552,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
551
552
|
- !ruby/object:Gem::Version
|
552
553
|
version: '0'
|
553
554
|
requirements: []
|
554
|
-
rubygems_version: 3.1.
|
555
|
+
rubygems_version: 3.1.1
|
555
556
|
signing_key:
|
556
557
|
specification_version: 4
|
557
558
|
summary: Toolkit for file attachments in Ruby applications
|