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