]> source.dussan.org Git - redmine.git/commitdiff
Merged r22684 from trunk to 5.0-stable (#40193).
authorGo MAEDA <maeda@farend.jp>
Wed, 7 Feb 2024 13:59:35 +0000 (13:59 +0000)
committerGo MAEDA <maeda@farend.jp>
Wed, 7 Feb 2024 13:59:35 +0000 (13:59 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22689 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/wiki_formatting/links_helper.rb

index 4595428a4687d25c99097cabe179e974d5b26d85..797ec0fde7ab207ef6744202abb1a5bbc8864e21 100644 (file)
@@ -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