Commit ac44ef0d by Sebastian Delmont

Remove mimemagic as it now released under a GPL license, incompatible with Paperclip's MIT license

parent e3f7493b
...@@ -64,8 +64,6 @@ rescue LoadError ...@@ -64,8 +64,6 @@ rescue LoadError
require "mime/types" require "mime/types"
end end
require 'mimemagic'
require 'mimemagic/overlay'
require 'logger' require 'logger'
require 'terrapin' require 'terrapin'
......
...@@ -60,18 +60,12 @@ module Paperclip ...@@ -60,18 +60,12 @@ module Paperclip
end end
def type_from_file_contents def type_from_file_contents
type_from_mime_magic || type_from_file_command type_from_file_command
rescue Errno::ENOENT => e rescue Errno::ENOENT => e
Paperclip.log("Error while determining content type: #{e}") Paperclip.log("Error while determining content type: #{e}")
SENSIBLE_DEFAULT SENSIBLE_DEFAULT
end end
def type_from_mime_magic
@type_from_mime_magic ||= File.open(@filepath) do |file|
MimeMagic.by_magic(file).try(:type)
end
end
def type_from_file_command def type_from_file_command
@type_from_file_command ||= @type_from_file_command ||=
FileCommandContentTypeDetector.new(@filepath).detect FileCommandContentTypeDetector.new(@filepath).detect
......
...@@ -28,7 +28,6 @@ Gem::Specification.new do |s| ...@@ -28,7 +28,6 @@ Gem::Specification.new do |s|
s.add_dependency('activesupport', '>= 4.2.0') s.add_dependency('activesupport', '>= 4.2.0')
s.add_dependency('terrapin', '~> 0.6.0') s.add_dependency('terrapin', '~> 0.6.0')
s.add_dependency('mime-types') s.add_dependency('mime-types')
s.add_dependency('mimemagic', '~> 0.3.0')
s.add_development_dependency('activerecord', '>= 4.2.0') s.add_development_dependency('activerecord', '>= 4.2.0')
s.add_development_dependency('shoulda') s.add_development_dependency('shoulda')
......
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