summaryrefslogtreecommitdiffstats
path: root/lib/redmine/wiki_formatting.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-06-17 19:27:03 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-06-17 19:27:03 +0000
commitd991e46f122d084c9465073256e7750b24898d49 (patch)
tree5b6f9b5938ebb237dbb714c95ed0223135e3a27e /lib/redmine/wiki_formatting.rb
parent3c95f761e610a1d5957ca9f96708958ba80565ab (diff)
downloadredmine-d991e46f122d084c9465073256e7750b24898d49.tar.gz
redmine-d991e46f122d084c9465073256e7750b24898d49.zip
Fixed: urls containing @ are parsed as email adress by the wiki formatter (#1456).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1559 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/wiki_formatting.rb')
-rw-r--r--lib/redmine/wiki_formatting.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb
index 88a858b04..6c8eebbbc 100644
--- a/lib/redmine/wiki_formatting.rb
+++ b/lib/redmine/wiki_formatting.rb
@@ -152,12 +152,16 @@ module Redmine
end
end
end
-
+
# Turns all email addresses into clickable links (code from Rails).
def inline_auto_mailto(text)
text.gsub!(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
- text = $1
- %{<a href="mailto:#{$1}" class="email">#{text}</a>}
+ mail = $1
+ if text.match(/<a\b[^>]*>(.*)(#{Regexp.escape(mail)})(.*)<\/a>/)
+ mail
+ else
+ %{<a href="mailto:#{mail}" class="email">#{mail}</a>}
+ end
end
end
end