Project

General

Profile

Defect #30371 » 0002-URL-followed-by-tag.patch

Yuichi HARADA, 2019-01-23 07:23

View differences:

lib/redmine/wiki_formatting.rb
126 126
                        (\/)?                    # slash
127 127
                      )
128 128
                      ((?:>)?|[^[:alnum:]_\=\/;\(\)]*?)               # post
129
                      (?=<|\s|$)
129
                      (?=&lt;|<|\s|$)
130 130
                     }x unless const_defined?(:AUTO_LINK_RE)
131 131

  
132 132
      # Destructively replaces urls into clickable links
lib/redmine/wiki_formatting/textile/redcloth3.rb
830 830
            (\/)?                      # $slash
831 831
            ([^[:alnum:]_\=\/;\(\)]*?)         # $post
832 832
            )
833
            (?=<|\s|$)
833
            (?=&lt;|<|\s|$)
834 834
        /x
835 835
#"
836 836
    def inline_textile_link( text )
test/helpers/application_helper_test.rb
282 282
    to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
283 283
  end
284 284

  
285
  def test_textile_external_links_with_followed_by_tag
286
    to_test = {
287
      '"test":http://foo/bar&lt;baz&gt;' => '<a href="http://foo/bar" class="external">test</a>&lt;baz&gt;',
288
    }
289
    to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
290
  end
291

  
285 292
  def test_redmine_links
286 293
    user_with_email_login = User.generate!(:login => 'abcd@example.com')
287 294
    user_with_email_login_2 = User.generate!(:login => 'foo.bar@example.com')
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
621 621
    assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '')
622 622
  end
623 623

  
624
  def test_should_link_url_with_followed_by_tag
625
    assert_html_output({
626
      'http://www.redmine.org/example&lt;foo&gt;' => '<a class="external" href="http://www.redmine.org/example">http://www.redmine.org/example</a>&lt;foo&gt;',
627
    })
628
  end
629

  
624 630
  private
625 631

  
626 632
  def assert_html_output(to_test, expect_paragraph = true)
(3-3/3)