From e35c8f7e2ec21a0f1dbf8a89d9b917650152dbc2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 10 Jul 2016 07:47:07 +0000 Subject: [PATCH] Merged r15607 (#23246). git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@15615 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/helpers/url.rb | 2 +- .../lib/redmine/wiki_formatting/markdown_formatter_test.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/redmine/helpers/url.rb b/lib/redmine/helpers/url.rb index 4177bf23e..0cc149c3b 100644 --- a/lib/redmine/helpers/url.rb +++ b/lib/redmine/helpers/url.rb @@ -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 diff --git a/test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb index 6222c21cc..b8aa37ff2 100644 --- a/test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb @@ -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 -- 2.39.5