r25161 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25160‎ | r25161 | r25162 >
Date:14:52, 26 August 2007
Author:brion
Status:old
Tags:
Comment:
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?
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -283,7 +283,12 @@
284284 if( preg_match( '!\[{2}(.*?)(?:\||\]{2})!', $text, $m ) ) {
285285 // Strip preceding colon used to "escape" categories, etc.
286286 // and URL-decode links
287 - $m[1] = urldecode( ltrim( $m[1], ':' ) );
 287+ if( strpos( $m[1], '%' ) !== false ) {
 288+ // Match behavior of inline link parsing here;
 289+ // don't interpret + as " " most of the time!
 290+ // It might be safe to just use rawurldecode instead, though.
 291+ $m[1] = urldecode( ltrim( $m[1], ':' ) );
 292+ }
288293 $title = Title::newFromText( $m[1] );
289294 // Redirects to Special:Userlogout are not permitted
290295 if( $title instanceof Title && !$title->isSpecial( 'Userlogout' ) )

Follow-up revisions

RevisionCommit summaryAuthorDate
r25223Merged revisions 25126-25214 via svnmerge from...david07:39, 28 August 2007

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r24505(bug 10683) Fix inconsistent handling of URL-encoded titles in links used in ...robchurch01:45, 1 August 2007
r24631Merged revisions 24480-24600 via svnmerge from...david18:39, 6 August 2007

Status & tagging log