Patch #34969 » 0002-Replace-MimeMagic-with-Marcel.patch
Gemfile | ||
---|---|---|
10 | 10 |
gem "mini_mime", "~> 1.0.1" |
11 | 11 |
gem "actionpack-xml_parser" |
12 | 12 |
gem 'roadie-rails', (RUBY_VERSION < '2.5' ? '~> 1.3.0' : '~> 2.2.0') |
13 |
gem "mimemagic"
|
|
13 |
gem 'marcel'
|
|
14 | 14 |
gem "mail", "~> 2.7.1" |
15 | 15 |
gem 'csv', (RUBY_VERSION < '2.5' ? ['>= 3.1.1', '<= 3.1.5'] : '~> 3.1.1') |
16 | 16 |
gem 'nokogiri', (RUBY_VERSION < '2.5' ? '~> 1.10.0' : '~> 1.11.1') |
lib/redmine/thumbnail.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
require 'fileutils' |
21 |
require 'mimemagic' |
|
22 | 21 | |
23 | 22 |
module Redmine |
24 | 23 |
module Thumbnail |
... | ... | |
35 | 34 | |
36 | 35 |
unless File.exists?(target) |
37 | 36 |
# Make sure we only invoke Imagemagick if the file type is allowed |
38 |
mime_type = File.open(source) {|f| MimeMagic.by_magic(f).try(:type)} |
|
39 |
return nil if mime_type.nil? |
|
37 |
mime_type = File.open(source) {|f| Marcel::MimeType.for(f)} |
|
40 | 38 |
return nil if !ALLOWED_TYPES.include? mime_type |
41 | 39 |
return nil if is_pdf && mime_type != "application/pdf" |
42 | 40 |
- « Previous
- 1
- 2
- Next »