From 56a9b26a39b311ccdba3aec7b7d8e19c7b805ef7 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Mon, 20 Sep 2004 16:23:10 +0000 Subject: [PATCH] Fix http://bugzilla.wikipedia.org/show_bug.cgi?id=538 Return an 'emptyfile' error page if filename is empty. --- includes/SpecialUpload.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 737c619730..c165513851 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -112,6 +112,8 @@ class UploadForm { global $wgCheckFileExtensions, $wgStrictFileExtensions; global $wgFileExtensions, $wgFileBlacklist, $wgUploadSizeWarning; + /** When using detailed copyright, if user filled field, assume he + * confirmed the upload */ if ( $wgUseCopyrightUpload ) { $this->mUploadAffirm = 1; if ($wgCheckCopyrightUpload && @@ -120,12 +122,13 @@ class UploadForm { } } + /** User need to confirm his upload */ if ( $this->mUploadAffirm != 1) { $this->mainUploadForm( WfMsg( 'noaffirmation' ) ); return; } - if ( '' != $this->mOname ) { + if ( $this->mOname != '' ) { $basename = strrchr( $this->mOname, '/' ); if ( false === $basename ) { $basename = $this->mOname; } @@ -152,7 +155,6 @@ class UploadForm { $basename = $bn; } - $nt = Title::newFromText( $basename ); if( !$nt ) { return $this->uploadError( wfMsg( 'illegalfilename', htmlspecialchars( $basename ) ) ); @@ -196,6 +198,9 @@ class UploadForm { } if($warning != '') return $this->uploadWarning($warning); } + } else { + return $this->uploadError('
  • '.wfMsg( 'emptyfile' ).'
  • '); + } if ( !is_null( $this->mUploadOldVersion ) ) { $wgUploadOldVersion = $this->mUploadOldVersion; -- 2.20.1