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:
parent
3568b3729c
commit
c4374cb960
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user