(bug 19509) can't upload to file called '0'. Patch by Lee Worden.
authorChad Horohoe <demon@users.mediawiki.org>
Sat, 4 Jul 2009 01:37:31 +0000 (01:37 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Sat, 4 Jul 2009 01:37:31 +0000 (01:37 +0000)
RELEASE-NOTES
includes/specials/SpecialUpload.php

index 6f2073a..5400a60 100644 (file)
@@ -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 ==
 
index 240d34a..b78993b 100644 (file)
@@ -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 =
                                "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " .
-                               ($this->mDesiredDestName?"":"onchange='fillDestFilename(\"wpUploadFile\")' ") .
+                               ($this->mDesiredDestName!=''?"":"onchange='fillDestFilename(\"wpUploadFile\")' ") .
                                "size='60' />" .
                                "<input type='hidden' name='wpSourceType' value='file' />" ;
                }