From a1df5a8aa2f26bdc83260cd552fd26739f492f81 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Sat, 4 Jul 2009 01:37:31 +0000 Subject: [PATCH] (bug 19509) can't upload to file called '0'. Patch by Lee Worden. --- RELEASE-NOTES | 3 +++ includes/specials/SpecialUpload.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6f2073a1f8..5400a608bb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -224,6 +224,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN whether the engines are actually available * (bug 19390) Omit the "printable version" link on the printable version * (bug 18394) img_auth.php now respects userCan +* (bug 19509) Uploading to a file named '0' previously treated it as null input + and attempted to upload with the source name. Now warns about not having an + extension (since 0.ext is perfectly valid) == API changes in 1.16 == diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 240d34ad31..b78993b0bb 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -405,7 +405,7 @@ class UploadForm { * filter out illegal characters, and try to make a legible name * out of it. We'll strip some silently that Title would die on. */ - if( $this->mDesiredDestName ) { + if( $this->mDesiredDestName != '' ) { $basename = $this->mDesiredDestName; } else { $basename = $this->mSrcName; @@ -1000,7 +1000,7 @@ wgUploadAutoFill = {$autofill}; return false; } - if( $this->mDesiredDestName ) { + if( $this->mDesiredDestName != '' ) { $title = Title::makeTitleSafe( NS_FILE, $this->mDesiredDestName ); // Show a subtitle link to deleted revisions (to sysops et al only) if( $title instanceof Title && ( $count = $title->isDeleted() ) > 0 && $wgUser->isAllowed( 'deletedhistory' ) ) { @@ -1136,7 +1136,7 @@ wgUploadAutoFill = {$autofill}; } else { $filename_form = "mDesiredDestName?"":"onchange='fillDestFilename(\"wpUploadFile\")' ") . + ($this->mDesiredDestName!=''?"":"onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='60' />" . "" ; } -- 2.20.1