allow-slashes-in-local-part.diff

patch to fix this - Go MAEDA, 2015-04-29 05:43

Download (1.64 KB)

View differences:

lib/redmine/wiki_formatting.rb (working copy)
135 135

  
136 136
      # Destructively replaces email addresses into clickable links
137 137
      def auto_mailto!(text)
138
        text.gsub!(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
138
        text.gsub!(/([\w\.!#\$%\-+.\/]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
139 139
          mail = $1
140 140
          if text.match(/<a\b[^>]*>(.*)(#{Regexp.escape(mail)})(.*)<\/a>/)
141 141
            mail
test/unit/lib/redmine/wiki_formatting_test.rb (working copy)
37 37
  def test_should_link_urls_and_email_addresses
38 38
    raw = <<-DIFF
39 39
This is a sample *text* with a link: http://www.redmine.org
40
and an email address foo@example.net
40
and email addresses foo@example.net and foo/bar@example.net
41 41
DIFF
42 42

  
43 43
    expected = <<-EXPECTED
44 44
<p>This is a sample *text* with a link: <a class="external" href="http://www.redmine.org">http://www.redmine.org</a><br />
45
and an email address <a class="email" href="mailto:foo@example.net">foo@example.net</a></p>
45
and email addresses <a class="email" href="mailto:foo@example.net">foo@example.net</a> and <a class="email" href="mailto:foo/bar@example.net">foo/bar@example.net</a></p>
46 46
EXPECTED
47 47

  
48 48
    assert_equal expected.gsub(%r{[\r\n\t]}, ''), Redmine::WikiFormatting::NullFormatter::Formatter.new(raw).to_html.gsub(%r{[\r\n\t]}, '')