From 79cbecae8373dea29839bdfbf1b71629736064d7 Mon Sep 17 00:00:00 2001 From: "This, that and the other" Date: Tue, 27 Dec 2016 20:51:50 +1100 Subject: [PATCH] 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 --- includes/parser/Parser.php | 2 +- tests/parser/parserTests.txt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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) -- 2.20.1