From 38c29d8956627fddec8f65cdb10c100b11cdcf14 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Wed, 31 Mar 2021 08:59:26 +0000 Subject: [PATCH] Merged r20862 from trunk to 4.1-stable (#34969). git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@20878 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- Gemfile | 2 +- lib/redmine/thumbnail.rb | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 70ce12357..62204e12b 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ gem "request_store", "~> 1.4.1" gem "mini_mime", "~> 1.0.1" gem "actionpack-xml_parser" gem "roadie-rails", (RUBY_VERSION < "2.5" ? "~> 1.3.0" : "~> 2.1.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') diff --git a/lib/redmine/thumbnail.rb b/lib/redmine/thumbnail.rb index f9db6c93f..2e506dc78 100644 --- a/lib/redmine/thumbnail.rb +++ b/lib/redmine/thumbnail.rb @@ -18,7 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. require 'fileutils' -require 'mimemagic' module Redmine module Thumbnail @@ -34,8 +33,7 @@ module Redmine return nil if is_pdf && !gs_available? 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" -- 2.39.5