paperclip 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of paperclip might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/Appraisals +5 -0
- data/Gemfile +7 -0
- data/NEWS +11 -0
- data/README.md +2 -2
- data/gemfiles/4.1.gemfile +11 -0
- data/lib/paperclip/callbacks.rb +11 -1
- data/lib/paperclip/has_attached_file.rb +2 -1
- data/lib/paperclip/locales/en.yml +1 -0
- data/lib/paperclip/version.rb +1 -1
- data/test/validators/media_type_spoof_detection_validator_test.rb +35 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b280fe3ddac312ba397836a6dbb268f3119b741a
|
4
|
+
data.tar.gz: 9034cfd55c882ef8c2b50ac8e98ccbcd212c746a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4def9d053ea08b067da60d48e548bdaeaedd2e8c1e82d3b8228857d253313ea105484d9c894edab7803d4a08569b7fc44d69a05fd221c3e8b234004075ec46be
|
7
|
+
data.tar.gz: d7694572fa8b724c945496299fc916c2e410acf617de7272e7c03218da1140eb8cfc67736a2c02c16afde04b957ad1626ef815a14b2a7c59591c3de5a67ededa
|
data/.travis.yml
CHANGED
@@ -17,8 +17,10 @@ gemfile:
|
|
17
17
|
- gemfiles/3.1.gemfile
|
18
18
|
- gemfiles/3.2.gemfile
|
19
19
|
- gemfiles/4.0.gemfile
|
20
|
+
- gemfiles/4.1.gemfile
|
20
21
|
|
21
22
|
matrix:
|
23
|
+
fast_finish: true
|
22
24
|
allow_failures:
|
23
25
|
- rvm: jruby-19mode
|
24
26
|
- rvm: rbx-19mode
|
@@ -26,3 +28,5 @@ matrix:
|
|
26
28
|
exclude:
|
27
29
|
- rvm: 1.9.2
|
28
30
|
gemfile: gemfiles/4.0.gemfile
|
31
|
+
- rvm: 1.9.2
|
32
|
+
gemfile: gemfiles/4.1.gemfile
|
data/Appraisals
CHANGED
data/Gemfile
CHANGED
@@ -7,3 +7,10 @@ gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
|
7
7
|
|
8
8
|
gem 'pry', :platform => :ruby
|
9
9
|
gem 'pry-byebug', :platform => :ruby
|
10
|
+
|
11
|
+
# Hinting at development dependencies
|
12
|
+
# Prevents bundler from taking a long-time to resolve
|
13
|
+
group :development, :test do
|
14
|
+
gem 'mime-types', '~> 1.16'
|
15
|
+
gem 'builder', '~> 3.1.4'
|
16
|
+
end
|
data/NEWS
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
New in 4.1.1:
|
2
|
+
|
3
|
+
* Improvement: Add defauly translations for spoof validation
|
4
|
+
* Bug Fix: Don't check for spoofs if the file hasn't changed
|
5
|
+
* Bug Fix: Callback chain terminator is different in Rails 4.1, remove warnings
|
6
|
+
* Improvement: Fixed various Ruby warnings
|
7
|
+
* Bug Fix: Give bundler a hint, so it doesn't run forever on a fresh bundle
|
8
|
+
* Improvement: Documentation fixes
|
9
|
+
* Improvement: Allow travis-ci to finish-fast
|
10
|
+
|
11
|
+
|
1
12
|
New in 4.1.0:
|
2
13
|
|
3
14
|
* Improvement: Add :content_type_mappings to correct for missing spoof types
|
data/README.md
CHANGED
@@ -64,7 +64,7 @@ Paperclip is distributed as a gem, which is how it should be used in your app.
|
|
64
64
|
Include the gem in your Gemfile:
|
65
65
|
|
66
66
|
```ruby
|
67
|
-
gem "paperclip", "~>
|
67
|
+
gem "paperclip", "~> 4.1"
|
68
68
|
```
|
69
69
|
|
70
70
|
If you're still using Rails 2.3.x, you should do this instead:
|
@@ -527,7 +527,7 @@ _NOTE: Because processors operate by turning the original attachment into the
|
|
527
527
|
styles, no processors will be run if there are no styles defined._
|
528
528
|
|
529
529
|
If you're interested in caching your thumbnail's width, height and size in the
|
530
|
-
database, take a look at the [paperclip-meta](https://github.com/
|
530
|
+
database, take a look at the [paperclip-meta](https://github.com/teeparham/paperclip-meta) gem.
|
531
531
|
|
532
532
|
Also, if you're interested in generating the thumbnail on-the-fly, you might want
|
533
533
|
to look into the [attachment_on_the_fly](https://github.com/drpentode/Attachment-on-the-Fly) gem.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "jruby-openssl", :platform=>:jruby
|
6
|
+
gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
|
7
|
+
gem "sqlite3", :platform=>:ruby
|
8
|
+
gem "rails", "~> 4.1.0.beta"
|
9
|
+
gem "paperclip", :path=>"../"
|
10
|
+
|
11
|
+
gemspec :path=>"../"
|
data/lib/paperclip/callbacks.rb
CHANGED
@@ -7,7 +7,7 @@ module Paperclip
|
|
7
7
|
|
8
8
|
module Defining
|
9
9
|
def define_paperclip_callbacks(*callbacks)
|
10
|
-
define_callbacks(*[callbacks, {:terminator =>
|
10
|
+
define_callbacks(*[callbacks, {:terminator => callback_terminator}].flatten)
|
11
11
|
callbacks.each do |callback|
|
12
12
|
eval <<-end_callbacks
|
13
13
|
def before_#{callback}(*args, &blk)
|
@@ -19,6 +19,16 @@ module Paperclip
|
|
19
19
|
end_callbacks
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def callback_terminator
|
26
|
+
if ::ActiveSupport::VERSION::STRING >= '4.1'
|
27
|
+
lambda { |target, result| result == false }
|
28
|
+
else
|
29
|
+
'result == false'
|
30
|
+
end
|
31
|
+
end
|
22
32
|
end
|
23
33
|
|
24
34
|
module Running
|
data/lib/paperclip/version.rb
CHANGED
@@ -6,7 +6,42 @@ class MediaTypeSpoofDetectionValidatorTest < Test::Unit::TestCase
|
|
6
6
|
@dummy = Dummy.new
|
7
7
|
end
|
8
8
|
|
9
|
+
def build_validator(options = {})
|
10
|
+
@validator = Paperclip::Validators::MediaTypeSpoofDetectionValidator.new(options.merge(
|
11
|
+
:attributes => :avatar
|
12
|
+
))
|
13
|
+
end
|
14
|
+
|
9
15
|
should "be on the attachment without being explicitly added" do
|
10
16
|
assert Dummy.validators_on(:avatar).any?{ |validator| validator.kind == :media_type_spoof_detection }
|
11
17
|
end
|
18
|
+
|
19
|
+
should "return default error message for spoofed media type" do
|
20
|
+
build_validator
|
21
|
+
file = File.new(fixture_file("5k.png"), "rb")
|
22
|
+
@dummy.avatar.assign(file)
|
23
|
+
|
24
|
+
detector = mock("detector", :spoofed? => true)
|
25
|
+
Paperclip::MediaTypeSpoofDetector.stubs(:using).returns(detector)
|
26
|
+
@validator.validate(@dummy)
|
27
|
+
|
28
|
+
assert_equal "has an extension that does not match its contents", @dummy.errors[:avatar].first
|
29
|
+
end
|
30
|
+
|
31
|
+
should "run when attachment is dirty" do
|
32
|
+
build_validator
|
33
|
+
file = File.new(fixture_file("5k.png"), "rb")
|
34
|
+
@dummy.avatar.assign(file)
|
35
|
+
Paperclip::MediaTypeSpoofDetector.stubs(:using).returns(stub(:spoofed? => false))
|
36
|
+
|
37
|
+
@dummy.valid?
|
38
|
+
|
39
|
+
assert_received(Paperclip::MediaTypeSpoofDetector, :using){|e| e.once }
|
40
|
+
end
|
41
|
+
|
42
|
+
should "not run when attachment is not dirty" do
|
43
|
+
Paperclip::MediaTypeSpoofDetector.stubs(:using).never
|
44
|
+
@dummy.valid?
|
45
|
+
assert_received(Paperclip::MediaTypeSpoofDetector, :using){|e| e.never }
|
46
|
+
end
|
12
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Yurek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -358,6 +358,7 @@ files:
|
|
358
358
|
- gemfiles/3.1.gemfile
|
359
359
|
- gemfiles/3.2.gemfile
|
360
360
|
- gemfiles/4.0.gemfile
|
361
|
+
- gemfiles/4.1.gemfile
|
361
362
|
- lib/generators/paperclip/USAGE
|
362
363
|
- lib/generators/paperclip/paperclip_generator.rb
|
363
364
|
- lib/generators/paperclip/templates/paperclip_migration.rb.erb
|