From: This, that and the other Date: Tue, 27 Dec 2016 09:51:50 +0000 (+1100) Subject: Parser: Trim leading whitespace from links before checking for leading : X-Git-Tag: 1.31.0-rc.0~4258 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=79cbecae8373dea29839bdfbf1b71629736064d7;p=lhc%2Fweb%2Fwiklou.git Parser: Trim leading whitespace from links before checking for leading : The leading spaces on the link only cause us problems, such as for the $noforce check 20 lines later. Bug: T129218 Change-Id: I93a8da1f73b38fa3da362f8f27479b3039ed3f13 --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 702a479635..3ec059632e 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2201,7 +2201,7 @@ class Parser { continue; } - $origLink = $m[1]; + $origLink = ltrim( $m[1], ' ' ); # Don't allow internal links to pages containing # PROTO: where PROTO is a valid URL protocol; these diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 3853a12520..ed09203434 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -8590,6 +8590,22 @@ Blah blah blah !! end +!! test +Escaping of interlanguage links +!! wikitext +Blah blah blah +[[:es:Spanish]] +[[ : zh : Chinese ]] +!! html/php +

Blah blah blah +es:Spanish + zh : Chinese +

+!! html/parsoid +

es:Spanish + zh : Chinese

+!! end + ## parsoid html2wt will normalize the space to _ !! test Space and question mark encoding in interlanguage links (T95473)