From: Platonides Date: Wed, 5 May 2010 22:37:59 +0000 (+0000) Subject: The pipe | character in urls is now escaped. This solves a parser test X-Git-Tag: 1.31.0-rc.0~36934 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=2519512cdce7e40356e9651e63ecaf6434d45c4d;p=lhc%2Fweb%2Fwiklou.git The pipe | character in urls is now escaped. This solves a parser test where a pipe in a url query inside an image caption confused the parser. Windows file://c|/... urls may be affected. See http://en.wikipedia.org/wiki/File_URI_scheme#Windows_2 --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ab130825bd..991df1afa3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -153,6 +153,7 @@ in a negative namespace (which is invalid). * (Bug 23241) Remove License selector, because it is not used when uploading a new version. * (bug 23240) Add ID to namespace selector form on Special:Watchlist +* The pipe | character in urls is now escaped. === API changes in 1.17 === * (bug 22738) Allow filtering by action type on query=logevent diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 3d9317e388..abc11f87b4 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -1493,7 +1493,7 @@ class Sanitizer { $url = Sanitizer::decodeCharReferences( $url ); # Escape any control characters introduced by the above step - $url = preg_replace( '/[\][<>"\\x00-\\x20\\x7F]/e', "urlencode('\\0')", $url ); + $url = preg_replace( '/[\][<>"\\x00-\\x20\\x7F\|]/e', "urlencode('\\0')", $url ); # Validate hostname portion $matches = array(); diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index ade29b75d6..7656f45aef 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -1514,7 +1514,7 @@ Piped link to URL !! input Piped link to URL: [[http://www.example.com|an example URL]] !! result -

Piped link to URL: [example URL] +

Piped link to URL: [example URL]

!! end @@ -6649,12 +6649,10 @@ disabled # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "" tag. !! test Images with the "|" character in the comment -!! options -disabled !! input [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|¶m2=|x external] URL]] !! result -
An external URL
An external URL
+
An external URL
!!end