From: Bryan Tong Minh Date: Sat, 19 Sep 2009 09:01:37 +0000 (+0000) Subject: Fix overwrite permission checking for users without reupload-shared right. X-Git-Tag: 1.31.0-rc.0~39633 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=b8184fde44a6715e7b76997e1bc4d9c730395637;p=lhc%2Fweb%2Fwiklou.git Fix overwrite permission checking for users without reupload-shared right. --- diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index dbbf1e1fad..76101075a4 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -915,14 +915,18 @@ abstract class UploadBase { global $wgUser; // First check whether the local file can be overwritten $file = $this->getLocalFile(); - if( $file->exists() ) + if( $file->exists() ) { if( !self::userCanReUpload( $wgUser, $file ) ) return 'fileexists-forbidden'; + else + return true; + } - // Check shared conflicts - $file = wfFindFile( $file->getName() ); - if ( $file && ( !$wgUser->isAllowed( 'reupload' ) || - !$wgUser->isAllowed( 'reupload-shared' ) ) ) + /* Check shared conflicts: if the local file does not exist, but + * wfFindFile finds a file, it exists in a shared repository. + */ + $file = wfFindFile( $this->getTitle() ); + if ( $file && !$wgUser->isAllowed( 'reupload-shared' ) ) return 'fileexists-shared-forbidden'; return true;