Commit 397457c4 by Tute Costa

Merge branch 'v4.2'

parents ecdd5427 15222186
appraise "3.2" do appraise "3.2" do
gem "rails", "~> 3.2.15" gem "rails", "~> 3.2.0"
gem "paperclip", :path => "../" gem "paperclip", :path => "../"
end end
......
...@@ -2,7 +2,7 @@ source "https://rubygems.org" ...@@ -2,7 +2,7 @@ source "https://rubygems.org"
gemspec gemspec
gem 'sqlite3', '~>1.3.8', :platforms => :ruby gem 'sqlite3', '~> 1.3.8', :platforms => :ruby
gem 'jruby-openssl', :platforms => :jruby gem 'jruby-openssl', :platforms => :jruby
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
......
New in 4.3.0: 4.3.0:
* Improvement: Update aws-sdk and cucumber gem versions. * Improvement: Update aws-sdk and cucumber gem versions.
* Improvement: Add `length` alias for `size` method in AbstractAdapter. * Improvement: Add `length` alias for `size` method in AbstractAdapter.
...@@ -11,11 +11,16 @@ New in 4.3.0: ...@@ -11,11 +11,16 @@ New in 4.3.0:
* Ruby Versioning: Drop support for 1.9.3 (EOL'ed) * Ruby Versioning: Drop support for 1.9.3 (EOL'ed)
* Rails Versioning: Drop support for 4.0.0 (EOL'ed) * Rails Versioning: Drop support for 4.0.0 (EOL'ed)
New in 4.2.2: 4.2.3:
* Fix dependency specifications (didn't work with Rails 4.1)
* Fix paperclip tests in CI
4.2.2:
* Security fix: Fix a potential security issue with spoofing * Security fix: Fix a potential security issue with spoofing
New in 4.2.1: 4.2.1:
* Improvement: Added `validate_media_type` options to allow/bypass spoof check * Improvement: Added `validate_media_type` options to allow/bypass spoof check
* Improvement: Added incremental backoff when AWS gives us a SlowDown error. * Improvement: Added incremental backoff when AWS gives us a SlowDown error.
...@@ -32,7 +37,7 @@ New in 4.2.1: ...@@ -32,7 +37,7 @@ New in 4.2.1:
* Test Fix: Improves speed and reliability of the specs * Test Fix: Improves speed and reliability of the specs
* Bug Fix: #original_filename= does not error when passed `nil` * Bug Fix: #original_filename= does not error when passed `nil`
New in 4.2.0: 4.2.0:
* Improvement: Converted test suite from test/unit to RSpec * Improvement: Converted test suite from test/unit to RSpec
* Improvement: Refactored Paperclip::Attachment#assign * Improvement: Refactored Paperclip::Attachment#assign
...@@ -48,7 +53,7 @@ New in 4.2.0: ...@@ -48,7 +53,7 @@ New in 4.2.0:
* Improvement: Allow `nil` geometry strings * Improvement: Allow `nil` geometry strings
* Improvement: Use `eager_load!` * Improvement: Use `eager_load!`
New in 4.1.1: 4.1.1:
* Improvement: Add default translations for spoof validation * Improvement: Add default translations for spoof validation
* Bug Fix: Don't check for spoofs if the file hasn't changed * Bug Fix: Don't check for spoofs if the file hasn't changed
...@@ -59,7 +64,7 @@ New in 4.1.1: ...@@ -59,7 +64,7 @@ New in 4.1.1:
* Improvement: Allow travis-ci to finish-fast * Improvement: Allow travis-ci to finish-fast
New in 4.1.0: 4.1.0:
* Improvement: Add :content_type_mappings to correct for missing spoof types * Improvement: Add :content_type_mappings to correct for missing spoof types
* Improvement: Credit Egor Homakov with discovering the content_type spoof bug * Improvement: Credit Egor Homakov with discovering the content_type spoof bug
...@@ -67,7 +72,7 @@ New in 4.1.0: ...@@ -67,7 +72,7 @@ New in 4.1.0:
* Improvement: Make MIME type optional for Data URIs. * Improvement: Make MIME type optional for Data URIs.
* Improvement: Add default format for styles * Improvement: Add default format for styles
New in 4.0.0: 4.0.0:
* Security: Attachments are checked to make sure they're not pulling a fast one. * Security: Attachments are checked to make sure they're not pulling a fast one.
* Security: It is now *enforced* that every attachment has a file/mime validation. * Security: It is now *enforced* that every attachment has a file/mime validation.
...@@ -75,7 +80,7 @@ New in 4.0.0: ...@@ -75,7 +80,7 @@ New in 4.0.0:
* Improvement: Added bullets to the 3.5.3 list of changes. Very important. * Improvement: Added bullets to the 3.5.3 list of changes. Very important.
* Improvement: Updated the copyright to 2014 * Improvement: Updated the copyright to 2014
New in 3.5.3: 3.5.3:
* Improvement: After three long, hard years... we know how to upgrade * Improvement: After three long, hard years... we know how to upgrade
* Bug Fix: #expiring_url returns 'missing' urls if nothing is attached * Bug Fix: #expiring_url returns 'missing' urls if nothing is attached
...@@ -97,14 +102,14 @@ New in 3.5.3: ...@@ -97,14 +102,14 @@ New in 3.5.3:
* Test Improvement: Ensure more files are properly closed during tests * Test Improvement: Ensure more files are properly closed during tests
* Test Bug Fix: Return the gemfile's syntax to normal * Test Bug Fix: Return the gemfile's syntax to normal
New in 3.5.2: 3.5.2:
* Security: Force cocaine to at least 0.5.3 to include a security fix * Security: Force cocaine to at least 0.5.3 to include a security fix
* Improvement: Fixed some README exmaples * Improvement: Fixed some README exmaples
* Feature: Added HTTP URL Proxy Adapter, can assign string URLs as attachments * Feature: Added HTTP URL Proxy Adapter, can assign string URLs as attachments
* Improvement: Put validation errors on the base attribute and the sub-attribute * Improvement: Put validation errors on the base attribute and the sub-attribute
New in 3.5.1: 3.5.1:
* Bug Fix: Returned the class-level `attachment_definitions` method for compatability. * Bug Fix: Returned the class-level `attachment_definitions` method for compatability.
* Improvement: Ensured compatability with Rails 4 * Improvement: Ensured compatability with Rails 4
...@@ -112,7 +117,7 @@ New in 3.5.1: ...@@ -112,7 +117,7 @@ New in 3.5.1:
* Bug Fix: #1296, where validations were generating errors * Bug Fix: #1296, where validations were generating errors
* Improvement: Specify MIT license in the gemspec * Improvement: Specify MIT license in the gemspec
New in 3.5.0: 3.5.0:
* Feature: Handle Base64-encoded data URIs as uploads * Feature: Handle Base64-encoded data URIs as uploads
* Feature: Add a FilenameCleaner class to allow custom filename sanitation * Feature: Add a FilenameCleaner class to allow custom filename sanitation
...@@ -128,7 +133,7 @@ New in 3.5.0: ...@@ -128,7 +133,7 @@ New in 3.5.0:
* Improvement: Added Ruby 2.0.0 as a supported platform and removed 1.8.7 * Improvement: Added Ruby 2.0.0 as a supported platform and removed 1.8.7
* Improvement: Fixed some incompatabilities in the test suite * Improvement: Fixed some incompatabilities in the test suite
New in 3.4.2: 3.4.2:
* Improvement: Use https for Gemfile urls * Improvement: Use https for Gemfile urls
* Improvement: Updated and more correct documentation * Improvement: Updated and more correct documentation
...@@ -138,7 +143,7 @@ New in 3.4.2: ...@@ -138,7 +143,7 @@ New in 3.4.2:
* Improvement: Remove path clash checking, as it's unnecessary * Improvement: Remove path clash checking, as it's unnecessary
* Bug Fix: Do not rely on checking version numbers for aws-sdk * Bug Fix: Do not rely on checking version numbers for aws-sdk
New in 3.4.1: 3.4.1:
* Improvement: Various documentation fixes and improvements * Improvement: Various documentation fixes and improvements
* Bug Fix: Clearing an attachment with `preserve_files` on should still clear the attachment * Bug Fix: Clearing an attachment with `preserve_files` on should still clear the attachment
...@@ -151,7 +156,7 @@ New in 3.4.1: ...@@ -151,7 +156,7 @@ New in 3.4.1:
* Improvement: Update to latest cocaine * Improvement: Update to latest cocaine
* Improvement: Update copyrights, various typos * Improvement: Update copyrights, various typos
New in 3.4.0: 3.4.0:
* Bug Fix: Allow UploadedFileAdapter to force the use of `file` * Bug Fix: Allow UploadedFileAdapter to force the use of `file`
* Bug Fix: Close the file handle when dealing with URIs * Bug Fix: Close the file handle when dealing with URIs
...@@ -181,11 +186,11 @@ New In 3.3.1: ...@@ -181,11 +186,11 @@ New In 3.3.1:
* Bug Fix: Moved Filesystem's copy_to_local_file to the right place. * Bug Fix: Moved Filesystem's copy_to_local_file to the right place.
New in 3.3.0: 3.3.0:
* Improvement: Upgrade cocaine to 0.4 * Improvement: Upgrade cocaine to 0.4
New in 3.2.0: 3.2.0:
* Bug Fix: Use the new correct Amazon S3 encryption header. * Bug Fix: Use the new correct Amazon S3 encryption header.
* Bug Fix: The rake task respects the updated_at column. * Bug Fix: The rake task respects the updated_at column.
...@@ -194,14 +199,14 @@ New in 3.2.0: ...@@ -194,14 +199,14 @@ New in 3.2.0:
* Feature: Automatically rotate images. * Feature: Automatically rotate images.
* Feature: Reduce class-oriented programming of the attachment definitions. * Feature: Reduce class-oriented programming of the attachment definitions.
New in 3.1.4: 3.1.4:
* Bug Fix: Allow user to be able to set path without `:style` attribute and not raising an error. * Bug Fix: Allow user to be able to set path without `:style` attribute and not raising an error.
This is a regression introduced in 3.1.3, and that feature will be postponed to another minor This is a regression introduced in 3.1.3, and that feature will be postponed to another minor
release instead. release instead.
* Feature: Allow for URI Adapter as an optional paperclip io adapter. * Feature: Allow for URI Adapter as an optional paperclip io adapter.
New in 3.1.3: 3.1.3:
* Bug Fix: Copy empty attachment between instances is now working. * Bug Fix: Copy empty attachment between instances is now working.
* Bug Fix: Correctly rescue Fog error. * Bug Fix: Correctly rescue Fog error.
...@@ -213,17 +218,17 @@ New in 3.1.3: ...@@ -213,17 +218,17 @@ New in 3.1.3:
* Bug Fix: Paperclip now gracefully handles msising file command. * Bug Fix: Paperclip now gracefully handles msising file command.
* Bug Fix: `StringIOAdapter` now accepts content type. * Bug Fix: `StringIOAdapter` now accepts content type.
New in 3.1.2: 3.1.2:
* Bug Fix: #remove_attachment on 3.1.0 and 3.1.1 mistakenly trying to remove the column that has * Bug Fix: #remove_attachment on 3.1.0 and 3.1.1 mistakenly trying to remove the column that has
the same name as data type (such as :string, :datetime, :interger.) You're advised to update to the same name as data type (such as :string, :datetime, :interger.) You're advised to update to
Paperclip 3.1.2 as soon as possible. Paperclip 3.1.2 as soon as possible.
New in 3.1.1: 3.1.1:
* Bug Fix: Paperclip will only load Paperclip::Schema only when Active Record is available. * Bug Fix: Paperclip will only load Paperclip::Schema only when Active Record is available.
New in 3.1.0: 3.1.0:
* Feature: Paperclip now support new migration syntax (sexy migration) that reads better: * Feature: Paperclip now support new migration syntax (sexy migration) that reads better:
...@@ -262,11 +267,11 @@ New in 3.1.0: ...@@ -262,11 +267,11 @@ New in 3.1.0:
the best_content_type to throw an error on trying nil.content_type. the best_content_type to throw an error on trying nil.content_type.
* Bug Fix: Fix problem when the gem cannot be installed on the system that has Asepsis installed. * Bug Fix: Fix problem when the gem cannot be installed on the system that has Asepsis installed.
New in 3.0.4: 3.0.4:
* Feature: Adds support for S3 scheme-less URL generation. * Feature: Adds support for S3 scheme-less URL generation.
New in 3.0.3: 3.0.3:
* Bug Fix: ThumbnailProcessor now correctly detects and preserve animated GIF. * Bug Fix: ThumbnailProcessor now correctly detects and preserve animated GIF.
* Bug Fix: File extension is now preserved in generated Tempfile from adapter. * Bug Fix: File extension is now preserved in generated Tempfile from adapter.
...@@ -289,7 +294,7 @@ New in 3.0.3: ...@@ -289,7 +294,7 @@ New in 3.0.3:
* Bug Fix: Fix attachment.reprocess! when using storage providers fog and s3. * Bug Fix: Fix attachment.reprocess! when using storage providers fog and s3.
* Bug Fix: Fix a problem with incorrect content_type detected with 'file' command for an empty file on Mac. * Bug Fix: Fix a problem with incorrect content_type detected with 'file' command for an empty file on Mac.
New in 3.0.2: 3.0.2:
* API CHANGE: Generated migration class name is now plural (AddAttachmentToUsers instead of AddAttachmentToUser) * API CHANGE: Generated migration class name is now plural (AddAttachmentToUsers instead of AddAttachmentToUser)
* API CHANGE: Remove Rails plugin initialization code. * API CHANGE: Remove Rails plugin initialization code.
...@@ -298,13 +303,13 @@ New in 3.0.2: ...@@ -298,13 +303,13 @@ New in 3.0.2:
* Bug Fix: Fix a problem when there's no logger specified. * Bug Fix: Fix a problem when there's no logger specified.
* Bug Fix: Fix a problem when attaching Rack::Test::UploadedFile instance. * Bug Fix: Fix a problem when attaching Rack::Test::UploadedFile instance.
New in 3.0.1: 3.0.1:
* Feature: Introduce Paperlip IO adapter. * Feature: Introduce Paperlip IO adapter.
* Bug Fix: Regression in AttachmentContentTypeValidator has been fixed. * Bug Fix: Regression in AttachmentContentTypeValidator has been fixed.
* API CHANGE: #to_file has been removed. Use the #copy_to_local_file method instead. * API CHANGE: #to_file has been removed. Use the #copy_to_local_file method instead.
New in 3.0.0: 3.0.0:
* API CHANGE: Paperclip now requires at least Ruby on Rails version 3.0.0 * API CHANGE: Paperclip now requires at least Ruby on Rails version 3.0.0
* API CHANGE: The default :url and :path have changed. The new scheme avoids * API CHANGE: The default :url and :path have changed. The new scheme avoids
...@@ -323,7 +328,7 @@ New in 3.0.0: ...@@ -323,7 +328,7 @@ New in 3.0.0:
* Bug Fix: File given to S3 and Fog storage will now be rewinded after flush_write. * Bug Fix: File given to S3 and Fog storage will now be rewinded after flush_write.
* Feature: You can now pass addional parameter to S3 expiring URL, such as :content_type. * Feature: You can now pass addional parameter to S3 expiring URL, such as :content_type.
New in 2.7.0: 2.7.0:
* Bug Fix: Checking the existence of a file on S3 handles all AWS errors. * Bug Fix: Checking the existence of a file on S3 handles all AWS errors.
* Bug Fix: Clear the fingerprint when removing an attachment. * Bug Fix: Clear the fingerprint when removing an attachment.
...@@ -332,25 +337,25 @@ New in 2.7.0: ...@@ -332,25 +337,25 @@ New in 2.7.0:
* Compatibility: Support for ActiveSupport < 2.3.12. * Compatibility: Support for ActiveSupport < 2.3.12.
* Compatibility: Support for Rails 3.2. * Compatibility: Support for Rails 3.2.
New in 2.6.0: 2.6.0:
* Bug Fix: Files are re-wound after reading. * Bug Fix: Files are re-wound after reading.
* Feature: Remove Rails dependency from specs that need Paperclip. * Feature: Remove Rails dependency from specs that need Paperclip.
* Feature: Validation matchers support conditionals. * Feature: Validation matchers support conditionals.
New in 2.5.2: 2.5.2:
* Bug Fix: Can be installed on Windows. * Bug Fix: Can be installed on Windows.
* Feature: The Fog bucket name, authentication, and host can be determined at runtime via Proc. * Feature: The Fog bucket name, authentication, and host can be determined at runtime via Proc.
* Feature: Special characters are replaced with underscores in #url and #path. * Feature: Special characters are replaced with underscores in #url and #path.
New in 2.5.1: 2.5.1:
* Feature: After we've computed the content type, pass it to Fog. * Feature: After we've computed the content type, pass it to Fog.
* Feature: S3 encryption with the new :s3_server_side_encryption option. * Feature: S3 encryption with the new :s3_server_side_encryption option.
* Feature: Works without ActiveRecord, allowing for e.g. mongo backends. * Feature: Works without ActiveRecord, allowing for e.g. mongo backends.
New in 2.5.0: 2.5.0:
* Performance: Only connect to S3 when absolutely needed. * Performance: Only connect to S3 when absolutely needed.
* Bug Fix: STI with cached classes respect new options. * Bug Fix: STI with cached classes respect new options.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~>1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", :platforms => :ruby
gem "jruby-openssl", :platforms => :jruby gem "jruby-openssl", :platforms => :jruby
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
gem "rubysl", :platforms => :rbx gem "rubysl", :platforms => :rbx
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~>1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", :platforms => :ruby
gem "jruby-openssl", :platforms => :jruby gem "jruby-openssl", :platforms => :jruby
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
gem "rubysl", :platforms => :rbx gem "rubysl", :platforms => :rbx
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~>1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", :platforms => :ruby
gem "jruby-openssl", :platforms => :jruby gem "jruby-openssl", :platforms => :jruby
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
gem "rubysl", :platforms => :rbx gem "rubysl", :platforms => :rbx
......
...@@ -20,18 +20,18 @@ Gem::Specification.new do |s| ...@@ -20,18 +20,18 @@ Gem::Specification.new do |s|
s.requirements << "ImageMagick" s.requirements << "ImageMagick"
s.required_ruby_version = ">= 2.0.0" s.required_ruby_version = ">= 2.0.0"
s.add_dependency('activemodel', '~> 3.2.0') s.add_dependency('activemodel', '>= 3.2.0')
s.add_dependency('activesupport', '~> 3.2.0') s.add_dependency('activesupport', '>= 3.2.0')
s.add_dependency('cocaine', '~> 0.5.5') s.add_dependency('cocaine', '~> 0.5.5')
s.add_dependency('mime-types') s.add_dependency('mime-types')
s.add_dependency('mimemagic', '0.3.0') s.add_dependency('mimemagic', '0.3.0')
s.add_development_dependency('activerecord', '~> 3.2.0') s.add_development_dependency('activerecord', '>= 3.2.0')
s.add_development_dependency('shoulda') s.add_development_dependency('shoulda')
s.add_development_dependency('rspec') s.add_development_dependency('rspec')
s.add_development_dependency('appraisal') s.add_development_dependency('appraisal')
s.add_development_dependency('mocha') s.add_development_dependency('mocha')
s.add_development_dependency('aws-sdk', '~> 1.6') s.add_development_dependency('aws-sdk', '>= 1.5.7', "<= 2.0")
s.add_development_dependency('bourne') s.add_development_dependency('bourne')
s.add_development_dependency('cucumber', '~> 1.3.18') s.add_development_dependency('cucumber', '~> 1.3.18')
s.add_development_dependency('aruba') s.add_development_dependency('aruba')
...@@ -44,7 +44,7 @@ Gem::Specification.new do |s| ...@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('rake') s.add_development_dependency('rake')
s.add_development_dependency('fakeweb') s.add_development_dependency('fakeweb')
s.add_development_dependency('railties') s.add_development_dependency('railties')
s.add_development_dependency('actionmailer', '~> 3.2.0') s.add_development_dependency('actionmailer', '>= 3.2.0')
s.add_development_dependency('generator_spec') s.add_development_dependency('generator_spec')
s.add_development_dependency('timecop') s.add_development_dependency('timecop')
end end
...@@ -3,32 +3,32 @@ require 'spec_helper' ...@@ -3,32 +3,32 @@ require 'spec_helper'
describe Paperclip::MediaTypeSpoofDetector do describe Paperclip::MediaTypeSpoofDetector do
it 'rejects a file that is named .html and identifies as PNG' do it 'rejects a file that is named .html and identifies as PNG' do
file = File.open(fixture_file("5k.png")) file = File.open(fixture_file("5k.png"))
assert Paperclip::MediaTypeSpoofDetector.using(file, "5k.html").spoofed? assert Paperclip::MediaTypeSpoofDetector.using(file, "5k.html", "image/png").spoofed?
end end
it 'does not reject a file that is named .jpg and identifies as PNG' do it 'does not reject a file that is named .jpg and identifies as PNG' do
file = File.open(fixture_file("5k.png")) file = File.open(fixture_file("5k.png"))
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "5k.jpg").spoofed? assert ! Paperclip::MediaTypeSpoofDetector.using(file, "5k.jpg", "image/png").spoofed?
end end
it 'does not reject a file that is named .html and identifies as HTML' do it 'does not reject a file that is named .html and identifies as HTML' do
file = File.open(fixture_file("empty.html")) file = File.open(fixture_file("empty.html"))
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html").spoofed? assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "text/html").spoofed?
end end
it 'does not reject a file that does not have a name' do it 'does not reject a file that does not have a name' do
file = File.open(fixture_file("empty.html")) file = File.open(fixture_file("empty.html"))
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "").spoofed? assert ! Paperclip::MediaTypeSpoofDetector.using(file, "", "").spoofed?
end end
it 'does not reject a file that does have an extension' do it 'does not reject a file that does have an extension' do
file = File.open(fixture_file("empty.html")) file = File.open(fixture_file("empty.html"))
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "data").spoofed? assert ! Paperclip::MediaTypeSpoofDetector.using(file, "data", "").spoofed?
end end
it 'does not reject when the supplied file is an IOAdapter' do it 'does not reject when the supplied file is an IOAdapter' do
adapter = Paperclip.io_adapters.for(File.new(fixture_file("5k.png"))) adapter = Paperclip.io_adapters.for(File.new(fixture_file("5k.png")))
assert ! Paperclip::MediaTypeSpoofDetector.using(adapter, adapter.original_filename).spoofed? assert ! Paperclip::MediaTypeSpoofDetector.using(adapter, adapter.original_filename, adapter.content_type).spoofed?
end end
it 'does not reject when the extension => content_type is in :content_type_mappings' do it 'does not reject when the extension => content_type is in :content_type_mappings' do
...@@ -38,7 +38,7 @@ describe Paperclip::MediaTypeSpoofDetector do ...@@ -38,7 +38,7 @@ describe Paperclip::MediaTypeSpoofDetector do
file.puts "Certificate!" file.puts "Certificate!"
file.close file.close
adapter = Paperclip.io_adapters.for(File.new(file.path)); adapter = Paperclip.io_adapters.for(File.new(file.path));
assert ! Paperclip::MediaTypeSpoofDetector.using(adapter, adapter.original_filename).spoofed? assert ! Paperclip::MediaTypeSpoofDetector.using(adapter, adapter.original_filename, adapter.content_type).spoofed?
ensure ensure
Paperclip.options[:content_type_mappings] = {} Paperclip.options[:content_type_mappings] = {}
end end
...@@ -49,7 +49,7 @@ describe Paperclip::MediaTypeSpoofDetector do ...@@ -49,7 +49,7 @@ describe Paperclip::MediaTypeSpoofDetector do
assert Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "image/jpg").spoofed? assert Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "image/jpg").spoofed?
end end
it "does not reject is content_type is empty but otherwise checks out" do it "does not reject if content_type is empty but otherwise checks out" do
file = File.open(fixture_file("empty.html")) file = File.open(fixture_file("empty.html"))
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "").spoofed? assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "").spoofed?
end end
......
...@@ -20,7 +20,7 @@ describe Paperclip do ...@@ -20,7 +20,7 @@ describe Paperclip do
it "saves Cocaine::CommandLine.path that set before" do it "saves Cocaine::CommandLine.path that set before" do
Cocaine::CommandLine.path = "/opt/my_app/bin" Cocaine::CommandLine.path = "/opt/my_app/bin"
Paperclip.run("convert", "stuff") Paperclip.run("convert", "stuff")
assert_equal Cocaine::CommandLine.path.include?("/opt/my_app/bin"), true expect(Cocaine::CommandLine.path).to match("/opt/my_app/bin")
end end
it "does not duplicate Cocaine::CommandLine.path on multiple runs" do it "does not duplicate Cocaine::CommandLine.path on multiple runs" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment