Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/paperclip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@
require "mime/types"
end

require 'mimemagic'
require 'mimemagic/overlay'
require 'logger'
require 'cocaine'

Expand Down
8 changes: 1 addition & 7 deletions lib/paperclip/content_type_detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,12 @@ def possible_types
end

def type_from_file_contents
type_from_mime_magic || type_from_file_command
type_from_file_command
rescue Errno::ENOENT => e
Paperclip.log("Error while determining content type: #{e}")
SENSIBLE_DEFAULT
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
@type_from_file_command ||=
FileCommandContentTypeDetector.new(@filepath).detect
Expand Down
1 change: 0 additions & 1 deletion paperclip.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Gem::Specification.new do |s|
s.add_dependency('activesupport', '>= 4.2.0')
s.add_dependency('cocaine', '~> 0.5.5')
s.add_dependency('mime-types')
s.add_dependency('mimemagic', '~> 0.3.0')

s.add_development_dependency('activerecord', '>= 4.2.0')
s.add_development_dependency('shoulda')
Expand Down