carrierwave 2.2.0 → 2.2.1
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 +4 -4
- data/README.md +18 -0
- data/lib/carrierwave/sanitized_file.rb +5 -6
- data/lib/carrierwave/storage/fog.rb +3 -2
- data/lib/carrierwave/version.rb +1 -1
- metadata +27 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a16b1f5ad9e05370bb6ad6381f5d94b36d3233c3ddbbd4782b54d3a01fb6a747
|
4
|
+
data.tar.gz: a5093ecbce4d1ee217c6b78b57f6c50d6ecad9cff0c3b865a22ebbbd196743aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 561070ea4b8d2eb9b6e606e4eb465aa3c6ecf3c5664102b5de9ada7317adbc8c8c2561b68baed39acb656cdece7509455e359b3f5ef9cb0e0c85202458c9ac02
|
7
|
+
data.tar.gz: 386f211d2fb219185543d330e84cbc7331ef8fe0f48992a9ef98f965e96dce2b7ec8731317951867bfc68bf7496c08211cc840003130cc20154dd4173b095d47
|
data/README.md
CHANGED
@@ -361,6 +361,22 @@ created. This can cut down on processing cost.
|
|
361
361
|
|
362
362
|
See `carrierwave/processing/mini_magick.rb` for details.
|
363
363
|
|
364
|
+
### conditional process
|
365
|
+
|
366
|
+
If you want to use conditional process, you can only use `if` statement.
|
367
|
+
|
368
|
+
See `carrierwave/uploader/processing.rb` for details.
|
369
|
+
|
370
|
+
```ruby
|
371
|
+
class MyUploader < CarrierWave::Uploader::Base
|
372
|
+
process :scale => [200, 200], :if => :image?
|
373
|
+
|
374
|
+
def image?(carrier_wave_sanitized_file)
|
375
|
+
true
|
376
|
+
end
|
377
|
+
end
|
378
|
+
```
|
379
|
+
|
364
380
|
### Nested versions
|
365
381
|
|
366
382
|
It is possible to nest versions within versions:
|
@@ -1056,6 +1072,8 @@ See [CONTRIBUTING.md](https://github.com/carrierwaveuploader/carrierwave/blob/ma
|
|
1056
1072
|
|
1057
1073
|
## License
|
1058
1074
|
|
1075
|
+
The MIT License (MIT)
|
1076
|
+
|
1059
1077
|
Copyright (c) 2008-2015 Jonas Nicklas
|
1060
1078
|
|
1061
1079
|
Permission is hereby granted, free of charge, to any person obtaining
|
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require 'active_support/core_ext/string/multibyte'
|
3
3
|
require 'mini_mime'
|
4
|
-
require '
|
5
|
-
require 'mimemagic/overlay'
|
4
|
+
require 'marcel'
|
6
5
|
|
7
6
|
module CarrierWave
|
8
7
|
|
@@ -262,7 +261,7 @@ module CarrierWave
|
|
262
261
|
def content_type
|
263
262
|
@content_type ||=
|
264
263
|
existing_content_type ||
|
265
|
-
|
264
|
+
marcel_magic_content_type ||
|
266
265
|
mini_mime_content_type
|
267
266
|
end
|
268
267
|
|
@@ -329,14 +328,14 @@ module CarrierWave
|
|
329
328
|
end
|
330
329
|
end
|
331
330
|
|
332
|
-
def
|
331
|
+
def marcel_magic_content_type
|
333
332
|
if path
|
334
333
|
type = File.open(path) do |file|
|
335
|
-
|
334
|
+
Marcel::Magic.by_magic(file).try(:type)
|
336
335
|
end
|
337
336
|
|
338
337
|
if type.nil?
|
339
|
-
type = ::
|
338
|
+
type = Marcel::Magic.by_path(file).try(:type)
|
340
339
|
type = 'invalid/invalid' unless type.nil? || type.start_with?('text/')
|
341
340
|
end
|
342
341
|
|
@@ -147,8 +147,9 @@ module CarrierWave
|
|
147
147
|
:public => uploader.fog_public
|
148
148
|
).files.all(:prefix => uploader.cache_dir).each do |file|
|
149
149
|
# generate_cache_id returns key formated TIMEINT-PID(-COUNTER)-RND
|
150
|
-
|
151
|
-
|
150
|
+
matched = file.key.match(/(\d+)-\d+-\d+(?:-\d+)?/)
|
151
|
+
next unless matched
|
152
|
+
time = Time.at(matched[1].to_i)
|
152
153
|
file.destroy if time < (Time.now.utc - seconds)
|
153
154
|
end
|
154
155
|
end
|
data/lib/carrierwave/version.rb
CHANGED
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: 2.2.
|
4
|
+
version: 2.2.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: 2021-
|
11
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: marcel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 1.0.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 1.0.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: addressable
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '3.4'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rspec-retry
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: webmock
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,6 +213,9 @@ dependencies:
|
|
199
213
|
- - "~>"
|
200
214
|
- !ruby/object:Gem::Version
|
201
215
|
version: '1.7'
|
216
|
+
- - "!="
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: 1.12.1
|
202
219
|
type: :development
|
203
220
|
prerelease: false
|
204
221
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -206,6 +223,9 @@ dependencies:
|
|
206
223
|
- - "~>"
|
207
224
|
- !ruby/object:Gem::Version
|
208
225
|
version: '1.7'
|
226
|
+
- - "!="
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: 1.12.1
|
209
229
|
- !ruby/object:Gem::Dependency
|
210
230
|
name: fog-local
|
211
231
|
requirement: !ruby/object:Gem::Requirement
|