Defect #36958 ยป 36958.patch
| lib/redmine/wiki_formatting/common_mark/external_links_filter.rb | ||
|---|---|---|
| 31 | 31 | 
    next unless url  | 
| 32 | 32 | 
                next if url.starts_with?("/") || url.starts_with?("#") || !url.include?(':')
   | 
| 33 | 33 | |
| 34 | 
    scheme = URI.parse(url).scheme  | 
|
| 34 | 
    begin  | 
|
| 35 | 
    scheme = URI.parse(url).scheme  | 
|
| 36 | 
    rescue URI::InvalidURIError  | 
|
| 37 | 
    scheme = nil  | 
|
| 38 | 
    end  | 
|
| 35 | 39 | 
    next if scheme.blank?  | 
| 36 | 40 | |
| 37 | 41 | 
    klass = node["class"].presence  | 
| test/unit/lib/redmine/wiki_formatting/common_mark/external_links_filter_test.rb | ||
|---|---|---|
| 44 | 44 | 
    def test_mailto_links_should_have_email_class  | 
| 45 | 45 | 
    assert_equal %(<a href="mailto:user@example.org" class="email">user</a>), filter(%(<a href="mailto:user@example.org">user</a>))  | 
| 46 | 46 | 
    end  | 
| 47 | ||
| 48 | 
    def test_malformed_uri_should_not_cause_exception  | 
|
| 49 | 
    assert_nothing_raised do  | 
|
| 50 | 
    filter(%(<a href="http://example.com/foo#bar#">Malformed URI</a>))  | 
|
| 51 | 
    end  | 
|
| 52 | 
    end  | 
|
| 47 | 53 | 
    end  | 
| 48 | 54 | 
    end  |