carrierwave 3.0.5 → 3.0.6

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: cc579131ed1965aefce70fdce2c9342f576b2d8ef07afbfdeafac862f0b18bfa
4
- data.tar.gz: 596d03d52c549e3e2a76f3857c1994d7e8eac60ac3262951232d0ee85137a553
3
+ metadata.gz: 3d156dd7cde36460576c176937cbe38967f0f7ed9f6d3e6fe602e4adc3fedee0
4
+ data.tar.gz: 4d09e2dae61f271be839edabe60811faa60beec6b699a391ab8f3f5b2a453f04
5
5
  SHA512:
6
- metadata.gz: a2bfddc631da38614bd60be423afc39ee59a904898ad998c11f6934b8c4adc5de4c51ccdc284b70ada8403f5285e6650df936c1dfd4963067ff60fd985736c06
7
- data.tar.gz: 997f8bf0b24e0327ec699246fe281f74d2d4dfc5c0e9086223da61a438d05cee0d436f23b24405d3e2866bc015e473302eab2bf5177a9f2891dbd188d95e1d9e
6
+ metadata.gz: c58ec99cca0ae6fa0068f93b2271f72581406a9a823b03a47f4cad744a758b33460f28de299ff7690022efb97dd277cd04ce5e87f0fc5a06c5cadbb42ef11f36
7
+ data.tar.gz: 7e588a03b01df29c687c5a418757d4a1d24e0bd22eeff21fd2409206020532f7536d31d6b69bd34c49b1928bde5cac72cea0bec7e23be014deef4fbeb59c7c8c
@@ -33,9 +33,9 @@ module CarrierWave
33
33
 
34
34
  def original_filename
35
35
  filename = filename_from_header || filename_from_uri
36
- mime_type = Marcel::TYPES[content_type]
37
- unless File.extname(filename).present? || mime_type.blank?
38
- extension = mime_type[0].first
36
+ extensions = Marcel::Magic.new(content_type).extensions
37
+ unless File.extname(filename).present? || extensions.blank?
38
+ extension = extensions.first
39
39
  filename = "#{filename}.#{extension}"
40
40
  end
41
41
  filename
@@ -24,11 +24,16 @@ module CarrierWave
24
24
 
25
25
  after_save :"store_#{column}!"
26
26
  before_save :"write_#{column}_identifier"
27
+ if ::ActiveRecord.try(:run_after_transaction_callbacks_in_order_defined)
28
+ after_commit :"remove_previously_stored_#{column}", :on => :update
29
+ after_commit :"reset_previous_changes_for_#{column}"
30
+ after_commit :"mark_remove_#{column}_false", :on => :update
31
+ else
32
+ after_commit :"mark_remove_#{column}_false", :on => :update
33
+ after_commit :"reset_previous_changes_for_#{column}"
34
+ after_commit :"remove_previously_stored_#{column}", :on => :update
35
+ end
27
36
  after_commit :"remove_#{column}!", :on => :destroy
28
- after_commit :"mark_remove_#{column}_false", :on => :update
29
-
30
- after_commit :"reset_previous_changes_for_#{column}"
31
- after_commit :"remove_previously_stored_#{column}", :on => :update
32
37
  after_rollback :"remove_rolled_back_#{column}"
33
38
 
34
39
  mod = Module.new
@@ -40,10 +40,10 @@ module CarrierWave
40
40
  #
41
41
  # === Returns
42
42
  #
43
- # [String] a temporary_identifier, by default @original_filename is used
43
+ # [String] a temporary_identifier, by default the value of #cache_name is used
44
44
  #
45
45
  def temporary_identifier
46
- @original_filename || @identifier
46
+ cache_name || @identifier
47
47
  end
48
48
 
49
49
  ##
@@ -279,7 +279,7 @@ module CarrierWave
279
279
  # that are the source of another version.
280
280
 
281
281
  self.cache_id = CarrierWave.generate_cache_id
282
- derived_versions.each do |name, v|
282
+ derived_versions.each_value do |v|
283
283
  v.cache!(file) if names.empty? || !(v.descendant_version_names & names).empty?
284
284
  end
285
285
  active_versions.each do |name, v|
@@ -308,13 +308,13 @@ module CarrierWave
308
308
  def derived_versions
309
309
  active_versions.reject do |name, v|
310
310
  v.class.version_options[:from_version]
311
- end.to_a + active_sibling_versions.select do |name, v|
311
+ end.merge(active_sibling_versions.select do |name, v|
312
312
  v.class.version_options[:from_version] == self.class.version_names.last
313
- end.to_a
313
+ end)
314
314
  end
315
315
 
316
316
  def active_sibling_versions
317
- parent_version&.active_versions || []
317
+ parent_version&.active_versions || {}
318
318
  end
319
319
 
320
320
  def full_filename(for_file)
@@ -326,23 +326,23 @@ module CarrierWave
326
326
  end
327
327
 
328
328
  def cache_versions!(new_file)
329
- derived_versions.each { |name, v| v.cache!(new_file) }
329
+ derived_versions.each_value { |v| v.cache!(new_file) }
330
330
  end
331
331
 
332
332
  def store_versions!(new_file)
333
- active_versions.each { |name, v| v.store!(new_file) }
333
+ active_versions.each_value { |v| v.store!(new_file) }
334
334
  end
335
335
 
336
336
  def remove_versions!
337
- versions.each { |name, v| v.remove! }
337
+ versions.each_value { |v| v.remove! }
338
338
  end
339
339
 
340
340
  def retrieve_versions_from_cache!(cache_name)
341
- active_versions.each { |name, v| v.retrieve_from_cache!(cache_name) }
341
+ active_versions.each_value { |v| v.retrieve_from_cache!(cache_name) }
342
342
  end
343
343
 
344
344
  def retrieve_versions_from_store!(identifier)
345
- active_versions.each { |name, v| v.retrieve_from_store!(identifier) }
345
+ active_versions.each_value { |v| v.retrieve_from_store!(identifier) }
346
346
  end
347
347
 
348
348
  end # Versions
@@ -1,3 +1,3 @@
1
1
  module CarrierWave
2
- VERSION = "3.0.5".freeze
2
+ VERSION = "3.0.6".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.5
4
+ version: 3.0.6
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-11-29 00:00:00.000000000 Z
11
+ date: 2024-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: csv
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: cucumber
99
113
  requirement: !ruby/object:Gem::Requirement