]> source.dussan.org Git - redmine.git/commitdiff
Fixed that empty Markdown image tag raises en error (#23246).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 6 Jul 2016 18:18:27 +0000 (18:18 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 6 Jul 2016 18:18:27 +0000 (18:18 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15607 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/helpers/url.rb
test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb

index 4177bf23eb23ecaaad73e2366ce9b0bfc3def62f..0cc149c3b8f91d7908af45e68506acbd127c29e5 100644 (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
index 6222c21cc3e224fc791913b343eb500c0652d66a..b8aa37ff2293951680f468da9dcabb2e29002155 100644 (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