Defect #30371
open
Textile formatter generates broken link if a URL is followed by a tag
Added by Go MAEDA almost 6 years ago.
Updated almost 6 years ago.
Description
[Input]
http://www.example.com/<foo>
[Expected output]
<a class="external" href="http://www.example.com/">http://www.example.com/</a><foo>
[Actual output]
<a class="external" href="http://www.example.com/&lt;foo">http://www.example.com/&lt;foo</a>
Files
I improved the regular expression to exclude subsequent characters on "<" 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
)
((?:>)?|[^[:alnum:]_\=\/;\(\)]*?) # post
- (?=<|\s|$)
+ (?=<|<|\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|$)
+ (?=<|<|\s|$)
/x
#"
def inline_textile_link( text )
- Target version set to Candidate for next minor release
Also available in: Atom
PDF