##// 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
@@ -152,12 +152,16 module Redmine
152 152 end
153 153 end
154 154 end
155
155
156 156 # Turns all email addresses into clickable links (code from Rails).
157 157 def inline_auto_mailto(text)
158 158 text.gsub!(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
159 text = $1
160 %{<a href="mailto:#{$1}" class="email">#{text}</a>}
159 mail = $1
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 165 end
162 166 end
163 167 end
@@ -34,7 +34,8 class ApplicationHelperTest < HelperTestCase
34 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 35 'www.foo.bar' => '<a class="external" href="http://www.foo.bar">www.foo.bar</a>',
36 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 40 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
40 41 end
General Comments 0
You need to be logged in to leave comments. Login now