From 4bbced90f4c454be8de2697e1f6a98b75060e706 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 26 Aug 2007 14:52:56 +0000 Subject: [PATCH] Fix regression caused by r24505 for bug 10683 -- was breaking redirects to pages using '+' in the title. Now matching parser inline link decoding; urldecode() is only run if %s are present. This does break something that has a literal % *and* a literal +, but that already matches Parser behavior. :P Should think about tweaking that to maybe use rawurldecode? --- includes/Title.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/Title.php b/includes/Title.php index e37ed07057..35d57dbf7e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -283,7 +283,12 @@ class Title { if( preg_match( '!\[{2}(.*?)(?:\||\]{2})!', $text, $m ) ) { // Strip preceding colon used to "escape" categories, etc. // and URL-decode links - $m[1] = urldecode( ltrim( $m[1], ':' ) ); + if( strpos( $m[1], '%' ) !== false ) { + // Match behavior of inline link parsing here; + // don't interpret + as " " most of the time! + // It might be safe to just use rawurldecode instead, though. + $m[1] = urldecode( ltrim( $m[1], ':' ) ); + } $title = Title::newFromText( $m[1] ); // Redirects to Special:Userlogout are not permitted if( $title instanceof Title && !$title->isSpecial( 'Userlogout' ) ) -- 2.20.1