##// END OF EJS Templates
Fixed: urls containing @ are parsed as email adress by the wiki formatter (#1456)....
Jean-Philippe Lang -
r1545:d991e46f122d
parent child
Show More
@@ -156,8 +156,12 module Redmine
156 # Turns all email addresses into clickable links (code from Rails).
156 # Turns all email addresses into clickable links (code from Rails).
157 def inline_auto_mailto(text)
157 def inline_auto_mailto(text)
158 text.gsub!(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
158 text.gsub!(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
159 text = $1
159 mail = $1
160 %{<a href="mailto:#{$1}" class="email">#{text}</a>}
160 if text.match(/<a\b[^>]*>(.*)(#{Regexp.escape(mail)})(.*)<\/a>/)
161 mail
162 else
163 %{<a href="mailto:#{mail}" class="email">#{mail}</a>}
164 end
161 end
165 end
162 end
166 end
163 end
167 end
@@ -34,7 +34,8 class ApplicationHelperTest < HelperTestCase
34 'http://foo.bar/foo.bar#foo.bar.' => '<a class="external" href="http://foo.bar/foo.bar#foo.bar">http://foo.bar/foo.bar#foo.bar</a>.',
34 'http://foo.bar/foo.bar#foo.bar.' => '<a class="external" href="http://foo.bar/foo.bar#foo.bar">http://foo.bar/foo.bar#foo.bar</a>.',
35 'www.foo.bar' => '<a class="external" href="http://www.foo.bar">www.foo.bar</a>',
35 'www.foo.bar' => '<a class="external" href="http://www.foo.bar">www.foo.bar</a>',
36 'http://foo.bar/page?p=1&t=z&s=' => '<a class="external" href="http://foo.bar/page?p=1&#38;t=z&#38;s=">http://foo.bar/page?p=1&#38;t=z&#38;s=</a>',
36 'http://foo.bar/page?p=1&t=z&s=' => '<a class="external" href="http://foo.bar/page?p=1&#38;t=z&#38;s=">http://foo.bar/page?p=1&#38;t=z&#38;s=</a>',
37 'http://foo.bar/page#125' => '<a class="external" href="http://foo.bar/page#125">http://foo.bar/page#125</a>'
37 'http://foo.bar/page#125' => '<a class="external" href="http://foo.bar/page#125">http://foo.bar/page#125</a>',
38 'http://foo@www.bar.com' => '<a class="external" href="http://foo@www.bar.com">http://foo@www.bar.com</a>',
38 }
39 }
39 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
40 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
40 end
41 end
General Comments 0
You need to be logged in to leave comments. Login now