carrierwave 3.0.1 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of carrierwave might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93ce71b0513b78b021bb85c121625135145ea8b78fc21bb64542e9114220d6cf
4
- data.tar.gz: cfa74c58a128998a51b9d50d1f1f5d44ca95aeeb1847ff860fc9e55aedc33f61
3
+ metadata.gz: e7d9ca1331d473162430928f5819d657e9c601b5663965a75f37c2eacb5bd344
4
+ data.tar.gz: a78745cfdebaa9b1d3cf49cfc513ac248d83690a6f1bafd6384dab81acd3e150
5
5
  SHA512:
6
- metadata.gz: 320adb08f7b9e280f43daa2663acd22bbe7bfc26a03461210a888e593136fd65c641f2aae3d332091ab4c59704cec6b9293864f85e7eb676ebebd06648c1b943
7
- data.tar.gz: 140d651ba46ecda9e0e9209e01731e02782d3e4dc113e6e0b042faa64b3277aace8ac1f69a9f626bf0e083f4b60b5b9665612ae66b481c1f96b0ef074961d7cc
6
+ metadata.gz: 51207e993ab7aaed4e68d338c7fdbfeee7f1334d914a403890c9364ad3d5aeadbd94206cc3b5fbb07bec7d7372abd346239e979a4d6c6f3c5278e92b4a823c94
7
+ data.tar.gz: fcc86123d64aabeb6de357cf81f632c3343b3951915d21f1b69e04c8bacb2e7e4c14c8efab9e4b0be33fac28efb228a0e7795615d19d913c33806eccb8adaedc
@@ -139,20 +139,22 @@ module CarrierWave
139
139
  end
140
140
 
141
141
  def store!
142
- additions, remains = uploaders.partition(&:cached?)
143
- existing_paths = (@removed_uploaders + remains).map(&:store_path)
144
- additions.each do |uploader|
145
- uploader.deduplicate(existing_paths)
146
- uploader.store!
147
- existing_paths << uploader.store_path
148
- end
149
- @added_uploaders += additions
142
+ uploaders.each(&:store!)
150
143
  end
151
144
 
152
145
  def write_identifier
153
146
  return if record.frozen?
154
147
 
155
148
  clear! if remove?
149
+
150
+ additions, remains = uploaders.partition(&:cached?)
151
+ existing_identifiers = (@removed_uploaders + remains).map(&:identifier)
152
+ additions.each do |uploader|
153
+ uploader.deduplicate(existing_identifiers)
154
+ existing_identifiers << uploader.identifier
155
+ end
156
+ @added_uploaders += additions
157
+
156
158
  record.write_uploader(serialization_column, identifier)
157
159
  end
158
160
 
@@ -44,9 +44,9 @@ module CarrierWave
44
44
  def initialize_dup(other)
45
45
  old_uploaders = _mounter(:"#{column}").uploaders
46
46
  @_mounters[:"#{column}"] = nil
47
+ super
47
48
  # The attribute needs to be cleared to prevent it from picked up as identifier
48
49
  write_attribute(:"#{column}", nil)
49
- super
50
50
  _mounter(:"#{column}").cache(old_uploaders)
51
51
  end
52
52
 
@@ -108,22 +108,22 @@ module CarrierWave
108
108
  end
109
109
 
110
110
  ##
111
- # Look for a store path which doesn't collide with the given already-stored paths.
111
+ # Look for an identifier which doesn't collide with the given already-stored identifiers.
112
112
  # It is done by adding a index number as the suffix.
113
113
  # For example, if there's 'image.jpg' and the @deduplication_index is set to 2,
114
114
  # The stored file will be named as 'image(2).jpg'.
115
115
  #
116
116
  # === Parameters
117
117
  #
118
- # [current_paths (Array[String])] List of paths for already-stored files
118
+ # [current_identifiers (Array[String])] List of identifiers for already-stored files
119
119
  #
120
- def deduplicate(current_paths)
120
+ def deduplicate(current_identifiers)
121
121
  @deduplication_index = nil
122
- return unless current_paths.include?(store_path)
122
+ return unless current_identifiers.include?(identifier)
123
123
 
124
- (1..current_paths.size + 1).each do |i|
124
+ (1..current_identifiers.size + 1).each do |i|
125
125
  @deduplication_index = i
126
- break unless current_paths.include?(store_path)
126
+ break unless current_identifiers.include?(identifier)
127
127
  end
128
128
  end
129
129
 
@@ -1,3 +1,3 @@
1
1
  module CarrierWave
2
- VERSION = "3.0.1".freeze
2
+ VERSION = "3.0.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-22 00:00:00.000000000 Z
11
+ date: 2023-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport