1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-05 23:21:31 +00:00

Fixed that empty Markdown image tag raises en error (#23246).

git-svn-id: http://svn.redmine.org/redmine/trunk@15607 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2016-07-06 18:18:27 +00:00
parent 974d6db6db
commit 4c2fcb0865
2 changed files with 5 additions and 1 deletions

View File

@ -23,7 +23,7 @@ module Redmine
def uri_with_safe_scheme?(uri, schemes = ['http', 'https', 'ftp', 'mailto', nil])
# URLs relative to the current document or document root (without a protocol
# separator, should be harmless
return true unless uri.include? ":"
return true unless uri.to_s.include? ":"
# Other URLs need to be parsed
schemes.include? URI.parse(uri).scheme

View File

@ -28,6 +28,10 @@ class Redmine::WikiFormatting::MarkdownFormatterTest < ActionView::TestCase
assert @formatter.new("!>[](foo.png)").to_html
end
def test_empty_image_should_not_raise_exception
assert @formatter.new("![]()").to_html
end
# re-using the formatter after getting above error crashes the
# ruby interpreter. This seems to be related to
# https://github.com/vmg/redcarpet/issues/318