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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5d7dc948b6f87906f3d62207c2d9a3642ee52b34ddabebdefbe5dcde3eb47f4
4
- data.tar.gz: acc1806a446bfd8e8c4e1f16a9b2e9a475ab3309296f8ba44a0cb6e3b255494c
3
+ metadata.gz: a7a482b7fc9181f9af0f7a9b9f4fa4d7cc131c9b30489414799b7a0cc16d2c26
4
+ data.tar.gz: f20feb6e99e26a0c7e4af2bd39b19f2ad5a90d369b142d699abedbaa23829d64
5
5
  SHA512:
6
- metadata.gz: 9cf334edc64829d8ae960e8e35037cdce590edcfc08b6f29fcbb0464337571bd015b938d38a7d0e0b7f77d7f2474a695a2f829c22884c91362ecba3be583bff7
7
- data.tar.gz: 96b16e3d76a6d670fbe1bd46393b8ba6ad0bdd6b79678c6100f305c5b5347c2a91a02679d21ebe22914e1e3d992094512d7821e142b3d539c78b439719036f98
6
+ metadata.gz: 547028b04de7538b83d9bb1685e3424722691be427c40a3c33545b646c5df99cb1ff01ea7b899c175bb330c0163c4359c5d437e6bda81063ae17e4efcbf03273
7
+ data.tar.gz: 824399812e4df139b35c13c0d45c0adcf35d5c41528ebd235b8d95ecd8d07d7a0b4ae0bb409bec0d7cefdc288dfae8522c1e6c79a39f36842b2ea6e7e6074623
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Valkyrie
4
4
  module Shrine
5
- VERSION = "0.5.0"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
@@ -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
- resource.id.to_s
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.5.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: 2021-04-20 00:00:00.000000000 Z
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