diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-07 08:40:28 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-07 08:40:28 +0000 |
commit | d4dcd3a8dc42506889a43eab3fc15d1474dee2ad (patch) | |
tree | 2a80c67acdb22732a8375f63bcbe9df1cf83188c | |
parent | 2551d68c1f74f296556e2fc687344eeaf82679d1 (diff) | |
download | redmine-d4dcd3a8dc42506889a43eab3fc15d1474dee2ad.tar.gz redmine-d4dcd3a8dc42506889a43eab3fc15d1474dee2ad.zip |
Merged r16092.
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16145 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | lib/redmine/thumbnail.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/redmine/thumbnail.rb b/lib/redmine/thumbnail.rb index 9321c7bb3..79eaf4ab7 100644 --- a/lib/redmine/thumbnail.rb +++ b/lib/redmine/thumbnail.rb @@ -23,13 +23,14 @@ module Redmine extend Redmine::Utils::Shell CONVERT_BIN = (Redmine::Configuration['imagemagick_convert_command'] || 'convert').freeze + ALLOWED_TYPES = %w(image/bmp image/gif image/jpeg image/png) # Generates a thumbnail for the source image to target def self.generate(source, target, size) return nil unless convert_available? unless File.exists?(target) - # Make sure we only invoke Imagemagick if this is actually an image - unless File.open(source) {|f| MimeMagic.by_magic(f).try(:image?)} + # 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) |