carrierwave 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/carrierwave/mounter.rb +2 -1
- data/lib/carrierwave/orm/activerecord.rb +1 -1
- data/lib/carrierwave/processing/mini_magick.rb +1 -1
- data/lib/carrierwave/sanitized_file.rb +23 -13
- data/lib/carrierwave/version.rb +1 -1
- data/lib/generators/templates/uploader.rb.erb +2 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 419200b4437cec891e52a5175c1d7b3f4ac26bbe53d5a499ffd78e823deebed1
|
4
|
+
data.tar.gz: 429982feec40f1ffaa18900f45e7615caea384dc6fb9871a9df3010b150e03f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ba037a1637b1e1991783ba94171869f25eb916643ae3769ac273dd967baef630e00add18beb53d773b7ab796b4ea9605d35bf349aa67c8086b205200a9a6b7e
|
7
|
+
data.tar.gz: 4accb3afbbb5a098552317d59194a9b8bfd2cf5f51c69d14ada968a4607469c7980eb66a54d3ac91c0ae9f3b0b54376ab9d8b6d4dd02cf7dd0eb74c93e7fd36b
|
data/lib/carrierwave/mounter.rb
CHANGED
@@ -168,6 +168,7 @@ module CarrierWave
|
|
168
168
|
end
|
169
169
|
|
170
170
|
def remove=(value)
|
171
|
+
uploaders # Ensure that uploaders are initialized based on the current value
|
171
172
|
@remove = value
|
172
173
|
write_temporary_identifier
|
173
174
|
end
|
@@ -220,7 +221,7 @@ module CarrierWave
|
|
220
221
|
end
|
221
222
|
|
222
223
|
def clear_unstaged
|
223
|
-
|
224
|
+
uploaders # Ensure that uploaders are initialized based on the current value
|
224
225
|
staged, unstaged = @uploaders.partition(&:staged)
|
225
226
|
@uploaders = staged
|
226
227
|
@removed_uploaders += unstaged
|
@@ -51,7 +51,7 @@ module CarrierWave
|
|
51
51
|
super
|
52
52
|
@_mounters[:"#{column}"] = nil
|
53
53
|
# The attribute needs to be cleared to prevent it from picked up as identifier
|
54
|
-
|
54
|
+
write_uploader(_mounter(:#{column}).serialization_column, nil)
|
55
55
|
_mounter(:"#{column}").cache(old_uploaders)
|
56
56
|
end
|
57
57
|
|
@@ -293,7 +293,7 @@ module CarrierWave
|
|
293
293
|
|
294
294
|
::MiniMagick::Image.new(current_path).identify
|
295
295
|
rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e
|
296
|
-
raise e if e.message =~ /(You must have .+ installed|is not installed|executable not found)/
|
296
|
+
raise e if e.message =~ /(You must have .+ installed|is not installed|executable not found|delegate failed)/
|
297
297
|
message = I18n.translate(:"errors.messages.processing_error")
|
298
298
|
raise CarrierWave::ProcessingError, message
|
299
299
|
ensure
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'pathname'
|
2
|
-
require 'active_support/core_ext/string/multibyte'
|
3
2
|
require 'marcel'
|
4
3
|
|
5
4
|
module CarrierWave
|
@@ -129,24 +128,35 @@ module CarrierWave
|
|
129
128
|
# [String] contents of the file
|
130
129
|
#
|
131
130
|
def read(*args)
|
132
|
-
if
|
133
|
-
if
|
131
|
+
if args.empty?
|
132
|
+
if @content
|
134
133
|
@content
|
134
|
+
elsif is_path?
|
135
|
+
File.open(@file, "rb") {|file| file.read }
|
135
136
|
else
|
136
|
-
|
137
|
-
|
138
|
-
@
|
137
|
+
@file.try(:rewind)
|
138
|
+
@content = @file.read
|
139
|
+
@file.try(:close) unless @file.class.ancestors.include?(::StringIO) || @file.try(:closed?)
|
140
|
+
@content
|
139
141
|
end
|
140
|
-
elsif is_path?
|
141
|
-
File.open(@file, "rb") {|file| file.read(*args)}
|
142
142
|
else
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
143
|
+
if is_path?
|
144
|
+
@file = File.open(path, "rb")
|
145
|
+
elsif @file.is_a?(CarrierWave::Uploader::Base)
|
146
|
+
@file = StringIO.new(@file.read)
|
147
|
+
end
|
148
|
+
|
149
|
+
@file.read(*args)
|
147
150
|
end
|
148
151
|
end
|
149
152
|
|
153
|
+
##
|
154
|
+
# Rewinds the underlying file.
|
155
|
+
#
|
156
|
+
def rewind
|
157
|
+
@file.rewind if @file.respond_to?(:rewind)
|
158
|
+
end
|
159
|
+
|
150
160
|
##
|
151
161
|
# Moves the file to the given path
|
152
162
|
#
|
@@ -301,7 +311,7 @@ module CarrierWave
|
|
301
311
|
name = name.gsub(sanitize_regexp, "_")
|
302
312
|
name = "_#{name}" if name =~ /\A\.+\z/
|
303
313
|
name = "unnamed" if name.size.zero?
|
304
|
-
name.
|
314
|
+
name.to_s
|
305
315
|
end
|
306
316
|
|
307
317
|
def declared_content_type
|
data/lib/carrierwave/version.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
class <%= class_name %>Uploader < CarrierWave::Uploader::Base
|
2
|
-
# Include RMagick or
|
2
|
+
# Include RMagick, MiniMagick, or Vips support:
|
3
3
|
# include CarrierWave::RMagick
|
4
4
|
# include CarrierWave::MiniMagick
|
5
|
+
# include CarrierWave::Vips
|
5
6
|
|
6
7
|
# Choose what kind of storage to use for this uploader:
|
7
8
|
storage :file
|
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.1.
|
4
|
+
version: 3.1.2
|
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: 2025-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: cucumber
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -232,14 +232,14 @@ dependencies:
|
|
232
232
|
requirements:
|
233
233
|
- - ">="
|
234
234
|
- !ruby/object:Gem::Version
|
235
|
-
version:
|
235
|
+
version: '0'
|
236
236
|
type: :development
|
237
237
|
prerelease: false
|
238
238
|
version_requirements: !ruby/object:Gem::Requirement
|
239
239
|
requirements:
|
240
240
|
- - ">="
|
241
241
|
- !ruby/object:Gem::Version
|
242
|
-
version:
|
242
|
+
version: '0'
|
243
243
|
- !ruby/object:Gem::Dependency
|
244
244
|
name: rmagick
|
245
245
|
requirement: !ruby/object:Gem::Requirement
|
@@ -386,7 +386,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
386
386
|
- !ruby/object:Gem::Version
|
387
387
|
version: '0'
|
388
388
|
requirements: []
|
389
|
-
rubygems_version: 3.
|
389
|
+
rubygems_version: 3.5.22
|
390
390
|
signing_key:
|
391
391
|
specification_version: 4
|
392
392
|
summary: Ruby file upload library
|