Project

General

Profile

Defect #40193 » 40193.patch

Go MAEDA, 2024-02-06 09:35

View differences:

lib/redmine/wiki_formatting/links_helper.rb
65 65

  
66 66
      # Destructively replaces email addresses into clickable links
67 67
      def auto_mailto!(text)
68
        text.gsub!(/([\w\.!#\$%\-+.\/]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
68
        # The maximum length of a local part is 64 characters (RFC 5321 Section 4.5.3.1.1),
69
        # and the maximum length of a DNS label is 63 characters (RFC 1034 Section 3.1).
70
        text.gsub!(/([\w\.!#\$%\-+.\/]{1,64}@[A-Za-z0-9\-]{1,63}(\.[A-Za-z0-9\-]{1,63})+)/) do
69 71
          mail = $1
70 72
          if /<a\b[^>]*>(.*)(#{Regexp.escape(mail)})(.*)<\/a>/.match?(text)
71 73
            mail
(2-2/2)