(bug 26995) Update filename field on Special:Upload after sanitizing
authorDerk-Jan Hartman <hartman@videolan.org>
Sat, 25 Aug 2012 23:25:12 +0000 (01:25 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Fri, 2 Nov 2012 16:03:51 +0000 (17:03 +0100)
Patchset 4: Whitespace fix and comment fixes
Patchset 6: Whitespace fix and rebase
Patchset 7: Alignment of comment

Change-Id: I85656a3647766f8a35a7baae1c656d8dc315fc91

RELEASE-NOTES-1.21
includes/specials/SpecialUpload.php

index 7111254..ce6966e 100644 (file)
@@ -57,6 +57,7 @@ production.
 * (bug 41494) Honor $wgLogExceptionBacktrace when logging non-API exceptions
   caught during API execution.
 * (bug 37963) Fixed loading process for user options
+* (bug 26995) Update filename field on Upload page after having sanitized it.
 
 === API changes in 1.21 ===
 * prop=revisions can now report the contentmodel and contentformat, see docs/contenthandler.txt
index fd24af1..73c7e2a 100644 (file)
@@ -312,12 +312,12 @@ class SpecialUpload extends SpecialPage {
                $this->showUploadForm( $form );
        }
        /**
-        * Stashes the upload, shows the main form, but adds an "continue anyway button".
+        * Stashes the upload, shows the main form, but adds a "continue anyway button".
         * Also checks whether there are actually warnings to display.
         *
         * @param $warnings Array
         * @return boolean true if warnings were displayed, false if there are no
-        *      warnings and the should continue processing like there was no warning
+        *         warnings and it should continue processing
         */
        protected function showUploadWarning( $warnings ) {
                # If there are no warnings, or warnings we can ignore, return early.
@@ -336,6 +336,9 @@ class SpecialUpload extends SpecialPage {
                $warningHtml = '<h2>' . $this->msg( 'uploadwarning' )->escaped() . "</h2>\n"
                        . '<ul class="warning">';
                foreach( $warnings as $warning => $args ) {
+                       if( $warning == 'badfilename' ) {
+                               $this->mDesiredDestName = Title::makeTitle( NS_FILE, $args )->getText();
+                       }
                        if( $warning == 'exists' ) {
                                $msg = "\t<li>" . self::getExistsWarning( $args ) . "</li>\n";
                        } elseif( $warning == 'duplicate' ) {