summaryrefslogtreecommitdiffstats
path: root/lib/redmine
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-02-07 13:58:51 +0000
committerGo MAEDA <maeda@farend.jp>2024-02-07 13:58:51 +0000
commit1dc51f11981dd94c6735fdc23b1e0f1cf56955dd (patch)
tree4ec3f2e3afc6fed464b55c85aba033519ba65c98 /lib/redmine
parentf65b10d8103b9d957c66e5fb6d2aa7e7f280159e (diff)
downloadredmine-1dc51f11981dd94c6735fdc23b1e0f1cf56955dd.tar.gz
redmine-1dc51f11981dd94c6735fdc23b1e0f1cf56955dd.zip
Merged r22684 from trunk to 5.1-stable (#40193).
git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@22688 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r--lib/redmine/wiki_formatting/links_helper.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/redmine/wiki_formatting/links_helper.rb b/lib/redmine/wiki_formatting/links_helper.rb
index 4595428a4..797ec0fde 100644
--- a/lib/redmine/wiki_formatting/links_helper.rb
+++ b/lib/redmine/wiki_formatting/links_helper.rb
@@ -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