Fix regression from r54429 "(bug 17864 + bug 19519) - Do input normalization on the...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 29 Sep 2009 17:27:21 +0000 (17:27 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 29 Sep 2009 17:27:21 +0000 (17:27 +0000)
This did some overactive canonicalization of the input username before username and database were split, breaking access to remote users where the database name contained an underscore -- it was changed to space.
This would also have broken numeric access, I think, but I didn't bother to test that. :)
Fix moves the username canonicalization down into fetchUser() after we split the name and database, so we now can access remote folks via non-canonical forms and we don't break the dbnames.

includes/specials/SpecialUserrights.php

index cd10217..d3c9a31 100644 (file)
@@ -54,7 +54,6 @@ class UserrightsPage extends SpecialPage {
                } else {
                        $this->mTarget = $wgRequest->getVal( 'user' );
                }
-               $this->mTarget = User::getCanonicalName( $this->mTarget );
 
                /*
                 * If the user is blocked and they only have "partial" access
@@ -312,6 +311,12 @@ class UserrightsPage extends SpecialPage {
                        if( !$name ) {
                                return new WikiErrorMsg( 'noname' );
                        }
+               } else {
+                       $name = User::getCanonicalName( $name );
+                       if( !$name ) {
+                               // invalid name
+                               return new WikiErrorMsg( 'nosuchusershort', $username );
+                       }
                }
 
                if( $database == '' ) {