1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-21 16:01:14 +00:00

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

Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@14237 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2015-05-08 07:03:00 +00:00
parent 3568b3729c
commit c4374cb960
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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