Commit b968236a authored by jplang's avatar jplang

Email addresses with slashes are not linked correctly (#19735).

Patch by Go MAEDA.

git-svn-id: https://svn.redmine.org/redmine/trunk@14237 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 19dd5f3d
......@@ -135,7 +135,7 @@ module Redmine
# Destructively replaces email addresses into clickable links
def auto_mailto!(text)
text.gsub!(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
text.gsub!(/([\w\.!#\$%\-+.\/]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
mail = $1
if text.match(/<a\b[^>]*>(.*)(#{Regexp.escape(mail)})(.*)<\/a>/)
mail
......
......@@ -48,6 +48,12 @@ EXPECTED
assert_equal expected.gsub(%r{[\r\n\t]}, ''), Redmine::WikiFormatting::NullFormatter::Formatter.new(raw).to_html.gsub(%r{[\r\n\t]}, '')
end
def test_should_link_email_with_slashes
raw = 'foo/bar@example.net'
expected = '<p><a class="email" href="mailto:foo/bar@example.net">foo/bar@example.net</a></p>'
assert_equal expected.gsub(%r{[\r\n\t]}, ''), Redmine::WikiFormatting::NullFormatter::Formatter.new(raw).to_html.gsub(%r{[\r\n\t]}, '')
end
def test_links_separated_with_line_break_should_link
raw = <<-DIFF
link: https://www.redmine.org
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment