Robert Vogel has submitted this change and it was merged.

Change subject: Fix for invalid file upload
......................................................................


Fix for invalid file upload

If a user selects a file that is not allowed by $wgFileExtensions and
tries to upload it (without noticing the message)

 $uploadForm->mDesiredDestName

is an empty string. In this case NSFileRepo causes a fatal error.

Jenkins breaks on this commit [1] because of the extensions dependency to 
"Lockdown". Therefor I'll do a manual verification.

[1] 
https://integration.wikimedia.org/ci/job/mwext-NSFileRepo-testextension-zend/3/console

Change-Id: Iada71324a867d9794dee3ce707236e2aca03132f
---
M NSFileRepo.php
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Robert Vogel: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/NSFileRepo.php b/NSFileRepo.php
index 56e7f9c..8b8da9c 100644
--- a/NSFileRepo.php
+++ b/NSFileRepo.php
@@ -80,6 +80,9 @@
 */
 function NSFileRepoNSCheck( $uploadForm ) {
        $title = Title::newFromText($uploadForm->mDesiredDestName);
+       if( $title === null ) {
+               return true;
+       }
        if ( $title->getNamespace() < 100 ) {
                $uploadForm->mDesiredDestName = preg_replace( "/:/", '-', 
$uploadForm->mDesiredDestName );
        } else {

-- 
To view, visit https://gerrit.wikimedia.org/r/192303
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iada71324a867d9794dee3ce707236e2aca03132f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/NSFileRepo
Gerrit-Branch: master
Gerrit-Owner: Robert Vogel <[email protected]>
Gerrit-Reviewer: Jpond <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to