carrierwave 3.0.3 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/carrierwave/downloader/remote_file.rb +3 -3
- data/lib/carrierwave/mount.rb +5 -0
- data/lib/carrierwave/orm/activerecord.rb +11 -6
- data/lib/carrierwave/sanitized_file.rb +1 -1
- data/lib/carrierwave/uploader/content_type_allowlist.rb +1 -1
- data/lib/carrierwave/uploader/proxy.rb +2 -2
- data/lib/carrierwave/uploader/store.rb +1 -1
- data/lib/carrierwave/uploader/versions.rb +9 -9
- data/lib/carrierwave/version.rb +1 -1
- data/lib/generators/templates/uploader.rb.erb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0521a369826478de3de2fa97eecc3c3b4cde957eae650f01e9a84064c7a942f
|
4
|
+
data.tar.gz: e9691718fd62655b3990754a334fe7f7637c6e4e9186fb5084aa0da227058bf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee8a2cbafe89e7f29b898940a2e9fbc391a015ea0a91fc04d00da62ea2ecd8b83721c4f0dc873551255117a59c9b61ac8b57902dc1fbec54f29817acff3f8746
|
7
|
+
data.tar.gz: 4bcd521bc40e84509b779312f5a6eab363bca8e9871c179fb6340044e46cf44397a58b4ba3133caaed71845b3a9630f74cd6da8356f835c2cc7ce17fa4e9be0c
|
@@ -33,9 +33,9 @@ module CarrierWave
|
|
33
33
|
|
34
34
|
def original_filename
|
35
35
|
filename = filename_from_header || filename_from_uri
|
36
|
-
|
37
|
-
unless File.extname(filename).present? ||
|
38
|
-
extension =
|
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
|
data/lib/carrierwave/mount.rb
CHANGED
@@ -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
|
@@ -43,10 +48,10 @@ module CarrierWave
|
|
43
48
|
# Reset cached mounter on record dup
|
44
49
|
def initialize_dup(other)
|
45
50
|
old_uploaders = _mounter(:"#{column}").uploaders
|
46
|
-
@_mounters[:"#{column}"] = nil
|
47
51
|
super
|
52
|
+
@_mounters[:"#{column}"] = nil
|
48
53
|
# The attribute needs to be cleared to prevent it from picked up as identifier
|
49
|
-
write_attribute(
|
54
|
+
write_attribute(_mounter(:#{column}).serialization_column, nil)
|
50
55
|
_mounter(:"#{column}").cache(old_uploaders)
|
51
56
|
end
|
52
57
|
|
@@ -307,7 +307,7 @@ module CarrierWave
|
|
307
307
|
def declared_content_type
|
308
308
|
@declared_content_type ||
|
309
309
|
if @file.respond_to?(:content_type) && @file.content_type
|
310
|
-
@file.content_type.to_s.chomp
|
310
|
+
Marcel::MimeType.for(declared_type: @file.content_type.to_s.chomp)
|
311
311
|
end
|
312
312
|
end
|
313
313
|
|
@@ -40,10 +40,10 @@ module CarrierWave
|
|
40
40
|
#
|
41
41
|
# === Returns
|
42
42
|
#
|
43
|
-
# [String] a temporary_identifier, by default
|
43
|
+
# [String] a temporary_identifier, by default the value of #cache_name is used
|
44
44
|
#
|
45
45
|
def temporary_identifier
|
46
|
-
|
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.
|
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.
|
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
|
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.
|
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.
|
333
|
+
active_versions.each_value { |v| v.store!(new_file) }
|
334
334
|
end
|
335
335
|
|
336
336
|
def remove_versions!
|
337
|
-
versions.
|
337
|
+
versions.each_value { |v| v.remove! }
|
338
338
|
end
|
339
339
|
|
340
340
|
def retrieve_versions_from_cache!(cache_name)
|
341
|
-
active_versions.
|
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.
|
345
|
+
active_versions.each_value { |v| v.retrieve_from_store!(identifier) }
|
346
346
|
end
|
347
347
|
|
348
348
|
end # Versions
|
data/lib/carrierwave/version.rb
CHANGED
@@ -42,6 +42,6 @@ class <%= class_name %>Uploader < CarrierWave::Uploader::Base
|
|
42
42
|
# Override the filename of the uploaded files:
|
43
43
|
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
44
44
|
# def filename
|
45
|
-
# "something.jpg"
|
45
|
+
# "something.jpg"
|
46
46
|
# end
|
47
47
|
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.
|
4
|
+
version: 3.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Nicklas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -95,19 +95,19 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: csv
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '3.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '3.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: cucumber
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -400,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
400
400
|
- !ruby/object:Gem::Version
|
401
401
|
version: '0'
|
402
402
|
requirements: []
|
403
|
-
rubygems_version: 3.
|
403
|
+
rubygems_version: 3.4.10
|
404
404
|
signing_key:
|
405
405
|
specification_version: 4
|
406
406
|
summary: Ruby file upload library
|