From: Brion Vibber Date: Sun, 26 Aug 2007 14:52:56 +0000 (+0000) Subject: Fix regression caused by r24505 for bug 10683 -- was breaking redirects to pages... X-Git-Tag: 1.31.0-rc.0~51655 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=4bbced90f4c454be8de2697e1f6a98b75060e706;p=lhc%2Fweb%2Fwiklou.git 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? --- 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' ) )