]> source.dussan.org Git - redmine.git/commitdiff
Merged r20861 from trunk to 4.1-stable (#34969).
authorGo MAEDA <maeda@farend.jp>
Wed, 31 Mar 2021 08:42:22 +0000 (08:42 +0000)
committerGo MAEDA <maeda@farend.jp>
Wed, 31 Mar 2021 08:42:22 +0000 (08:42 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@20877 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/thumbnail.rb

index cc9656b3e25818fc0054d24d2ae422966e42d9ba..f9db6c93ffe4aac7d720093ae5af4dbe0d775c2d 100644 (file)
@@ -33,15 +33,12 @@ module Redmine
       return nil unless convert_available?
       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?
         return nil if !ALLOWED_TYPES.include? mime_type
         return nil if is_pdf && mime_type != "application/pdf"
 
-        # Make sure we only invoke Imagemagick if the file type is allowed
-        unless File.open(source) {|f| ALLOWED_TYPES.include? MimeMagic.by_magic(f).try(:type) }
-          return nil
-        end
         directory = File.dirname(target)
         unless File.exists?(directory)
           FileUtils.mkdir_p directory