Project

General

Profile

Actions

Defect #30371

open

Textile formatter generates broken link if a URL is followed by a tag

Added by Go MAEDA over 5 years ago. Updated about 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Text formatting
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

[Input]

http://www.example.com/<foo>

[Expected output]

<a class="external" href="http://www.example.com/">http://www.example.com/</a>&lt;foo&gt;

[Actual output]

<a class="external" href="http://www.example.com/&amp;lt;foo">http://www.example.com/&amp;lt;foo</a>


Files

Actions #1

Updated by Yuichi HARADA about 5 years ago

I improved the regular expression to exclude subsequent characters on "&lt;" from a URL.
I attached patches.

diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb
index 66764551d..8bd8f64bc 100644
--- a/lib/redmine/wiki_formatting.rb
+++ b/lib/redmine/wiki_formatting.rb
@@ -126,7 +126,7 @@ module Redmine
                         (\/)?                    # slash
                       )
                       ((?:&gt;)?|[^[:alnum:]_\=\/;\(\)]*?)               # post
-                      (?=<|\s|$)
+                      (?=&lt;|<|\s|$)
                      }x unless const_defined?(:AUTO_LINK_RE)

       # Destructively replaces urls into clickable links
diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb
index 9107da611..ff0621b9f 100644
--- a/lib/redmine/wiki_formatting/textile/redcloth3.rb
+++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb
@@ -830,7 +830,7 @@ class RedCloth3 < String
             (\/)?                      # $slash
             ([^[:alnum:]_\=\/;\(\)]*?)         # $post
             )
-            (?=<|\s|$)
+            (?=&lt;|<|\s|$)
         /x
 #" 
     def inline_textile_link( text )

Actions #2

Updated by Go MAEDA about 5 years ago

  • Target version set to Candidate for next minor release
Actions

Also available in: Atom PDF