card-mod-carrierwave 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/carrier_wave/file_card_uploader.rb +4 -5
- data/set/abstract/attachment.rb +30 -12
- data/set/type/image/html_views.rb +11 -3
- 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: 34b28c82c148d656ea2b868af80d713a79b0ae318cc3594daaeb0b174f9ad476
|
4
|
+
data.tar.gz: a8dea9684fae1880d58d26fb3a2731c3afa0a8ed5b40b115bac844d887ac22a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ac6214d839224cb946be3f23c12fa0a5291f9338b4124f31c8106dae432f3f1edd2cb02de9e4a405735e3c69181fd15dd4e872bc289a9c93d4321c2d86fc780
|
7
|
+
data.tar.gz: 0a0e99bfb0a5a9be113ce186683166ae880031fd15c2723ed00cce9f13eb8cea191ceead6155d3258fee5d3de171a71fdf41d6092248c15e1c3249a97e36dd23
|
@@ -279,8 +279,7 @@ module CarrierWave
|
|
279
279
|
end
|
280
280
|
|
281
281
|
def original_filename
|
282
|
-
@original_filename ||= model.selected_action
|
283
|
-
model.selected_action.comment
|
282
|
+
@original_filename ||= model.selected_action&.comment
|
284
283
|
end
|
285
284
|
|
286
285
|
def action_id
|
@@ -288,7 +287,7 @@ module CarrierWave
|
|
288
287
|
end
|
289
288
|
|
290
289
|
# delegate carrierwave's fog config methods to bucket configuration
|
291
|
-
|
290
|
+
CONFIG_OPTIONS.each do |name|
|
292
291
|
define_method("fog_#{name}") { bucket_config name }
|
293
292
|
end
|
294
293
|
|
@@ -311,9 +310,9 @@ module CarrierWave
|
|
311
310
|
def storage
|
312
311
|
case @model.storage_type
|
313
312
|
when :cloud
|
314
|
-
|
313
|
+
Storage::Fog.new self
|
315
314
|
else
|
316
|
-
|
315
|
+
Storage::File.new self
|
317
316
|
end
|
318
317
|
end
|
319
318
|
end
|
data/set/abstract/attachment.rb
CHANGED
@@ -75,7 +75,7 @@ end
|
|
75
75
|
|
76
76
|
def assign_set_specific_attributes
|
77
77
|
# reset content if we really have something to upload
|
78
|
-
self.content = nil if set_specific[attachment_name
|
78
|
+
self.content = nil if set_specific[attachment_name].present?
|
79
79
|
super
|
80
80
|
end
|
81
81
|
|
@@ -95,18 +95,36 @@ def revision action, before_action=false
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def attachment_format ext
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
if exts.find { |mt| mt.extensions.member? ext }
|
103
|
-
ext
|
104
|
-
else
|
105
|
-
exts[0].extensions[0]
|
106
|
-
end
|
107
|
-
end
|
98
|
+
rescuing_extension_issues do
|
99
|
+
return unless ext.present? && original_extension
|
100
|
+
|
101
|
+
confirm_original_extension(ext) || detect_extension(ext)
|
108
102
|
end
|
109
|
-
|
103
|
+
end
|
104
|
+
|
105
|
+
def rescuing_extension_issues
|
106
|
+
yield
|
107
|
+
rescue StandardError => e
|
110
108
|
Rails.logger.info "attachment_format issue: #{e.message}"
|
111
109
|
nil
|
112
110
|
end
|
111
|
+
|
112
|
+
def detect_extension ext
|
113
|
+
return unless (mime_types = Mime::Types[attachment.content_type])
|
114
|
+
|
115
|
+
recognized_extension?(mime_types, ext) ? ext : mime_types[0].extensions[0]
|
116
|
+
end
|
117
|
+
|
118
|
+
def recognized_extension? mime_types, ext
|
119
|
+
mime_types.find { |mt| mt.extensions.member? ext }
|
120
|
+
end
|
121
|
+
|
122
|
+
def confirm_original_extension ext
|
123
|
+
return unless ["file", original_extension].member? ext
|
124
|
+
|
125
|
+
original_extension
|
126
|
+
end
|
127
|
+
|
128
|
+
def original_extension
|
129
|
+
@original_extension ||= attachment&.extension&.sub(/^\./, "")
|
130
|
+
end
|
@@ -55,12 +55,20 @@ format :html do
|
|
55
55
|
|
56
56
|
def old_image action, hide_diff
|
57
57
|
return if hide_diff || !action
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
|
59
|
+
old_image_change action do |old_action_id|
|
60
|
+
card.with_selected_action_id old_action_id do
|
61
|
+
Card::Content::Diff.render_deleted_chunk _render_core
|
62
|
+
end
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
66
|
+
def old_image_change action
|
67
|
+
return unless (change = card.last_change_on(:db_content, before: action))
|
68
|
+
|
69
|
+
yield change.card_action_id
|
70
|
+
end
|
71
|
+
|
64
72
|
def new_image action
|
65
73
|
card.with_selected_action_id action.id do
|
66
74
|
Card::Content::Diff.render_added_chunk _render_core
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-carrierwave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.101.
|
21
|
+
version: 1.101.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.101.
|
28
|
+
version: 1.101.1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: carrierwave
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,28 +60,28 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.11.
|
63
|
+
version: 0.11.1
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.11.
|
70
|
+
version: 0.11.1
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: card-mod-permissions
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.11.
|
77
|
+
version: 0.11.1
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - '='
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.11.
|
84
|
+
version: 0.11.1
|
85
85
|
description: ''
|
86
86
|
email:
|
87
87
|
- info@decko.org
|