Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Removed mimemagic and falling back to file due to incompatible licence #2680

Open
wants to merge 1 commit into
base: v4.3
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
@@ -1,3 +1,7 @@
4.3.8 (25/3/2021):

* Removed mimemagic dependency due to newly incompatible licence

4.3.7 (7/1/2016):

* Add deprecation warnings
Expand Down
2 changes: 0 additions & 2 deletions lib/paperclip.rb
Expand Up @@ -65,8 +65,6 @@
require "mime/types"
end

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

Expand Down
7 changes: 1 addition & 6 deletions lib/paperclip/content_type_detector.rb
Expand Up @@ -60,17 +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 ||=
MimeMagic.by_magic(File.open(@filepath)).try(:type)
end

def type_from_file_command
@type_from_file_command ||=
FileCommandContentTypeDetector.new(@filepath).detect
Expand Down
2 changes: 1 addition & 1 deletion lib/paperclip/version.rb
@@ -1,3 +1,3 @@
module Paperclip
VERSION = "4.3.7".freeze unless defined? Paperclip::VERSION
VERSION = "4.3.6".freeze unless defined? Paperclip::VERSION

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isnt the next version 4.3.8?

Suggested change
VERSION = "4.3.6".freeze unless defined? Paperclip::VERSION
VERSION = "4.3.8".freeze unless defined? Paperclip::VERSION

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah! It turns out I can't increment numbers- must have missed that day in school.

I no longer have access to the original repo I made this PR from, so please feel free to close this PR.

end
1 change: 0 additions & 1 deletion paperclip.gemspec
Expand Up @@ -24,7 +24,6 @@ Gem::Specification.new do |s|
s.add_dependency('activesupport', '>= 3.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', '>= 3.2.0')
s.add_development_dependency('shoulda')
Expand Down