(bug 15470) First letters of filenames are always capitalized by upload JS
authorMax Semenik <maxsem@users.mediawiki.org>
Sun, 8 Aug 2010 06:35:41 +0000 (06:35 +0000)
committerMax Semenik <maxsem@users.mediawiki.org>
Sun, 8 Aug 2010 06:35:41 +0000 (06:35 +0000)
RELEASE-NOTES
includes/specials/SpecialUpload.php
skins/common/upload.js

index 319c3c2..53ae0f3 100644 (file)
@@ -280,6 +280,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   to avoid query errors about duplicate keynames.
 * (bug 24700) Update dialog shown when clicking on the special page tab after
   saving preferences
+* (bug 15470) First letters of filenames are always capitalized by upload JS.
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent.
index d8ad6f2..a4aa086 100644 (file)
@@ -1056,6 +1056,7 @@ class UploadForm extends HTMLForm {
                                $this->mDestFile === '',
                        'wgUploadSourceIds' => $this->mSourceIds,
                        'wgStrictFileExtensions' => $wgStrictFileExtensions,
+                       'wgCapitalizeUploads' => MWNamespace::isCapitalized( NS_FILE ),
                );
 
                $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) );
index 538c05c..17368ee 100644 (file)
@@ -271,9 +271,12 @@ function fillDestFilename(id) {
                }
        }
 
-       // Capitalise first letter and replace spaces by underscores
-       // FIXME: $wgCapitalizedNamespaces
-       fname = fname.charAt(0).toUpperCase().concat(fname.substring(1,10000)).replace(/ /g, '_');
+       // Replace spaces by underscores
+       fname = fname.replace( / /g, '_' );
+       // Capitalise first letter if needed
+       if ( wgCapitalizeUploads ) {
+               fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) );
+       }
 
        // Output result
        var destFile = document.getElementById('wpDestFile');