summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-03-27 10:16:34 +0000
committerGo MAEDA <maeda@farend.jp>2021-03-27 10:16:34 +0000
commit3a962fe36549588284eb1c3b126789a193702cad (patch)
treef99b9aa6abdae43b9fccbb50220ed53098a188bc /lib
parentbaba49c099899ada65dbab0f2ea502ed2041d2be (diff)
downloadredmine-3a962fe36549588284eb1c3b126789a193702cad.tar.gz
redmine-3a962fe36549588284eb1c3b126789a193702cad.zip
Remove duplicate code in Redmine::Thumbnail.generate (#34969).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@20861 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/thumbnail.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/redmine/thumbnail.rb b/lib/redmine/thumbnail.rb
index 32fd035be..53a0f5350 100644
--- a/lib/redmine/thumbnail.rb
+++ b/lib/redmine/thumbnail.rb
@@ -34,16 +34,12 @@ 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?
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