valkyrie-shrine 0.5.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/valkyrie/shrine/version.rb +1 -1
- data/lib/valkyrie/storage/shrine.rb +13 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7a482b7fc9181f9af0f7a9b9f4fa4d7cc131c9b30489414799b7a0cc16d2c26
|
4
|
+
data.tar.gz: f20feb6e99e26a0c7e4af2bd39b19f2ad5a90d369b142d699abedbaa23829d64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 547028b04de7538b83d9bb1685e3424722691be427c40a3c33545b646c5df99cb1ff01ea7b899c175bb330c0163c4359c5d437e6bda81063ae17e4efcbf03273
|
7
|
+
data.tar.gz: 824399812e4df139b35c13c0d45c0adcf35d5c41528ebd235b8d95ecd8d07d7a0b4ae0bb409bec0d7cefdc288dfae8522c1e6c79a39f36842b2ea6e7e6074623
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'shrine'
|
4
4
|
require 'digest/md5'
|
5
|
+
require 'securerandom'
|
5
6
|
|
6
7
|
module Valkyrie
|
7
8
|
module Storage
|
@@ -11,12 +12,20 @@ module Valkyrie
|
|
11
12
|
attr_reader :shrine, :verifier, :path_generator, :identifier_prefix
|
12
13
|
|
13
14
|
class IDPathGenerator
|
14
|
-
def initialize(base_path: nil)
|
15
|
-
@base_path = base_path
|
16
|
-
end
|
15
|
+
def initialize(base_path: nil); end
|
17
16
|
|
17
|
+
# @return [String]
|
18
18
|
def generate(resource:, file:, original_filename:)
|
19
|
-
|
19
|
+
# Because Valkyrie has to maintain compatibility with ActiveFedora via
|
20
|
+
# the wings adapter, the file passed to #upload has to be saved before
|
21
|
+
# its associated FileMetadata; this means that the resource provided
|
22
|
+
# here is the parent FileSet rather than the FileMetadata object. As
|
23
|
+
# a result, when we upload derivatives (like thumbnails) we have to
|
24
|
+
# pass the same resource as for the original file. If we relied on
|
25
|
+
# the resource.id to generate the ID for the StreamFile here, that
|
26
|
+
# would result in derivative uploads overwriting their originals.
|
27
|
+
# Thus we use a UUID, prefixed by the resource ID.
|
28
|
+
"#{resource.id}/#{SecureRandom.uuid}"
|
20
29
|
end
|
21
30
|
end
|
22
31
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valkyrie-shrine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendan Quinn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|