(bug 24022) Don't check extensions of files in uploadpage script when $wgStrictFileEx...
authorDerk-Jan Hartman <hartman@users.mediawiki.org>
Thu, 1 Jul 2010 19:55:04 +0000 (19:55 +0000)
committerDerk-Jan Hartman <hartman@users.mediawiki.org>
Thu, 1 Jul 2010 19:55:04 +0000 (19:55 +0000)
RELEASE-NOTES
includes/specials/SpecialUpload.php
skins/common/upload.js

index 198ad31..7b00497 100644 (file)
@@ -221,6 +221,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 23642) Recognize mime types of MS OpenXML documents.
 * (bug 22784) Normalise underscores and spaces in autocomments.
 * (bug 19910) Headings of the form ===+\s+ are now displayed as valid headings
+* (bug 24022) Only check file extensions on the uploadpage when needed.
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent.
index 681fcfc..dc1da4a 100644 (file)
@@ -1044,7 +1044,7 @@ class UploadForm extends HTMLForm {
         * Add upload JS to $wgOut
         */
        protected function addUploadJS() {
-               global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview, $wgEnableAPI;
+               global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview, $wgEnableAPI, $wgStrictFileExtensions;
                global $wgOut;
 
                $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck;
@@ -1058,6 +1058,7 @@ class UploadForm extends HTMLForm {
                                // the wpDestFile textbox
                                $this->mDestFile === '',
                        'wgUploadSourceIds' => $this->mSourceIds,
+                       'wgStrictFileExtensions' => $wgStrictFileExtensions,
                );
 
                $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) );
index fc16ebc..55f8c69 100644 (file)
@@ -242,7 +242,7 @@ function fillDestFilename(id) {
        // Clear the filename if it does not have a valid extension.
        // URLs are less likely to have a useful extension, so don't include them in the 
        // extension check.
-       if( wgFileExtensions && id != 'wpUploadFileURL' ) {
+       if( $wgStrictFileExtensions && wgFileExtensions && id != 'wpUploadFileURL' ) {
                var found = false;
                if( fname.lastIndexOf( '.' ) != -1 ) {
                        var ext = fname.substr( fname.lastIndexOf( '.' ) + 1 );