mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-31 11:37:14 +00:00
Fix performance issue with email address auto-linking in the default ("none") formatter (#40193).
Patch by Go MAEDA (@maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@22684 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4451e753a7
commit
ba2c48717d
@ -65,7 +65,10 @@ 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
|
||||
# The maximum length of a local part is 64 characters (RFC 5321
|
||||
# Section 4.5.3.1.1), and the maximum length of a DNS label is
|
||||
# 63 characters (RFC 1034 Section 3.1).
|
||||
text.gsub!(/([\w\.!#\$%\-+.\/]{1,64}@[A-Za-z0-9\-]{1,63}(\.[A-Za-z0-9\-]{1,63})+)/) do
|
||||
mail = $1
|
||||
if /<a\b[^>]*>(.*)(#{Regexp.escape(mail)})(.*)<\/a>/.match?(text)
|
||||
mail
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user