carrierwave 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 418e6b0903adc403510724ba7a5764e8edaa5b4bc96d5313e8f01572bf26ceac
4
- data.tar.gz: 0bbac560a7928ce059afccb2280a1f77d17c9bca418a3f471097a3e3375fc6d0
3
+ metadata.gz: 558934b4dcea4b5aed9f60fe4cf4f87d3c1963e9f3e2a835117b226d01996462
4
+ data.tar.gz: 0d8933eafbc965bfd9f482f7978f5f45ff803115cc470a9e63eb05a41763b969
5
5
  SHA512:
6
- metadata.gz: 253d7d3f2e78fd169e347042c6eae2d5ab70f1383dc159988387215cb669ca905232817484f168816c21bcfb6733221a69c6ae02d7a463df920446ee53ae8efd
7
- data.tar.gz: 7640c8c67f2bb11025a42c9b05752a167a3da4d3452dc3359ffc51e5cb5ea8460fd23be401446734daa573e77f9a0639b7f2cf053288d8c5360e63907a80f08c
6
+ metadata.gz: 4852bd015f5bae013c9da67d48d121998e6a77d08dc52674b24ca96b276b5ce272bbdf480cc062f30159e1ef0b6a47e4ddbfc5659c575cd358e7000aca86029b
7
+ data.tar.gz: 75eaf047f5ec552fc0ede4acad3947671f1429a8e982044aceba6c6452a6c213eef7db14ef41c254762e3d74e7ed8e0c2d733026586c0d583b4e535185161cd2
@@ -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
- write_attribute(_mounter(:#{column}).serialization_column, nil)
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 @content
133
- if args.empty?
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
- length, outbuf = args
137
- raise ArgumentError, "outbuf argument not supported since the content is already loaded" if outbuf
138
- @content[0, length]
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
- @file.try(:rewind)
144
- @content = @file.read(*args)
145
- @file.try(:close) unless @file.class.ancestors.include?(::StringIO) || @file.try(:closed?)
146
- @content
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.mb_chars.to_s
314
+ name.to_s
305
315
  end
306
316
 
307
317
  def declared_content_type
@@ -1,3 +1,3 @@
1
1
  module CarrierWave
2
- VERSION = "3.1.0".freeze
2
+ VERSION = "3.1.1".freeze
3
3
  end
@@ -1,7 +1,8 @@
1
1
  class <%= class_name %>Uploader < CarrierWave::Uploader::Base
2
- # Include RMagick or MiniMagick support:
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.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-14 00:00:00.000000000 Z
11
+ date: 2025-01-12 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: '2.3'
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: '2.3'
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
127
  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.4.10
389
+ rubygems_version: 3.5.22
390
390
  signing_key:
391
391
  specification_version: 4
392
392
  summary: Ruby file upload library