Index: trunk/phase3/includes/api/ApiUpload.php |
— | — | @@ -82,11 +82,15 @@ |
83 | 83 | // Check if the uploaded file is sane |
84 | 84 | $this->verifyUpload(); |
85 | 85 | |
86 | | - // Check permission to upload this file |
87 | | - $permErrors = $this->mUpload->verifyTitlePermissions( $wgUser ); |
88 | | - if ( $permErrors !== true ) { |
89 | | - // TODO: stash the upload and allow choosing a new name |
90 | | - $this->dieUsageMsg( array( 'badaccess-groups' ) ); |
| 86 | + // Check if the user has the rights to modify or overwrite the requested title |
| 87 | + // (This check is irrelevant if stashing is already requested, since the errors |
| 88 | + // can always be fixed by changing the title) |
| 89 | + if ( ! $this->mParams['stash'] ) { |
| 90 | + $permErrors = $this->mUpload->verifyTitlePermissions( $wgUser ); |
| 91 | + if ( $permErrors !== true ) { |
| 92 | + // TODO: stash the upload and allow choosing a new name |
| 93 | + $this->dieUsageMsg( array( 'badaccess-groups' ) ); |
| 94 | + } |
91 | 95 | } |
92 | 96 | |
93 | 97 | // Prepare the API result |