mirror of
https://github.com/redmine/redmine.git
synced 2026-01-26 01:10:01 +01:00
Don't try to generate thumbnails if convert command is not available (#32289).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@18885 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -201,7 +201,9 @@ class Attachment < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def thumbnailable?
|
||||
image? || (is_pdf? && Redmine::Thumbnail.gs_available?)
|
||||
Redmine::Thumbnail.convert_available? && (
|
||||
image? || (is_pdf? && Redmine::Thumbnail.gs_available?)
|
||||
)
|
||||
end
|
||||
|
||||
# Returns the full path the attachment thumbnail, or nil
|
||||
|
||||
@@ -420,7 +420,12 @@ class AttachmentTest < ActiveSupport::TestCase
|
||||
assert_equal true, Attachment.new(:filename => 'test.jpg').thumbnailable?
|
||||
end
|
||||
|
||||
def test_thumbnailable_should_be_true_for_non_images
|
||||
def test_thumbnailable_should_be_false_for_images_if_convert_is_unavailable
|
||||
Redmine::Thumbnail.stubs(:convert_available?).returns(false)
|
||||
assert_equal false, Attachment.new(:filename => 'test.jpg').thumbnailable?
|
||||
end
|
||||
|
||||
def test_thumbnailable_should_be_false_for_non_images
|
||||
assert_equal false, Attachment.new(:filename => 'test.txt').thumbnailable?
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user