mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-10 03:03:05 +00:00
Wrong syntax for resizing inline images may throw a 500 error (#20278).
Fix by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@14473 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
279e4b7aa0
commit
ef003caab2
@ -294,7 +294,7 @@ class Attachment < ActiveRecord::Base
|
|||||||
|
|
||||||
def self.latest_attach(attachments, filename)
|
def self.latest_attach(attachments, filename)
|
||||||
attachments.sort_by(&:created_on).reverse.detect do |att|
|
attachments.sort_by(&:created_on).reverse.detect do |att|
|
||||||
att.filename.downcase == filename.downcase
|
filename.casecmp(att.filename) == 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -327,6 +327,13 @@ class AttachmentTest < ActiveSupport::TestCase
|
|||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_latest_attach_should_not_error_with_string_with_invalid_encoding
|
||||||
|
string = "width:50\xFE-Image.jpg".force_encoding('UTF-8')
|
||||||
|
assert_equal false, string.valid_encoding?
|
||||||
|
|
||||||
|
Attachment.latest_attach(Attachment.limit(2).to_a, string)
|
||||||
|
end
|
||||||
|
|
||||||
def test_thumbnailable_should_be_true_for_images
|
def test_thumbnailable_should_be_true_for_images
|
||||||
assert_equal true, Attachment.new(:filename => 'test.jpg').thumbnailable?
|
assert_equal true, Attachment.new(:filename => 'test.jpg').thumbnailable?
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user