* (bug 10631) Warn when illegal characters are removed from filename at upload
authorRaimond Spekking <raymond@users.mediawiki.org>
Wed, 18 Jul 2007 16:04:49 +0000 (16:04 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Wed, 18 Jul 2007 16:04:49 +0000 (16:04 +0000)
Probably a regression, I am sure I have seen this warning in the past

RELEASE-NOTES
includes/SpecialUpload.php

index 1bd5f40..66834b4 100644 (file)
@@ -315,7 +315,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 10615) Fix for transwiki import when CURL not available
 * (bug 8054) Return search page for empty search requests with ugly URLs
 * (bug 10572) Force refresh after clearing visitation timestamps on watchlist
-
+* (bug 10631) Warn when illegal characters are removed from filename at upload
 
 == API changes since 1.10 ==
 
index 9394108..83b3811 100644 (file)
@@ -284,16 +284,17 @@ class UploadForm {
 
                # Chop off any directories in the given filename
                if( $this->mDesiredDestName ) {
-                       $basename = wfBaseName( $this->mDesiredDestName );
+                       $basename = $this->mDesiredDestName;
                } else {
-                       $basename = wfBaseName( $this->mSrcName );
+                       $basename = $this->mSrcName;
                }
+               $filtered = wfBaseName( $basename );
 
                /**
                 * We'll want to blacklist against *any* 'extension', and use
                 * only the final one for the whitelist.
                 */
-               list( $partname, $ext ) = $this->splitExtensions( $basename );
+               list( $partname, $ext ) = $this->splitExtensions( $filtered );
 
                if( count( $ext ) ) {
                        $finalExt = $ext[count( $ext ) - 1];
@@ -317,7 +318,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.
                 */
-               $filtered = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $basename );
+               $filtered = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $filtered );
                $nt = Title::makeTitleSafe( NS_IMAGE, $filtered );
                if( is_null( $nt ) ) {
                        $this->uploadError( wfMsgWikiHtml( 'illegalfilename', htmlspecialchars( $filtered ) ) );
@@ -388,7 +389,7 @@ class UploadForm {
                        if( $wgCapitalLinks ) {
                                $filtered = ucfirst( $filtered );
                        }
-                       if( $this->mDestName != $filtered ) {
+                       if( $basename != $filtered ) {
                                $warning .=  '<li>'.wfMsgHtml( 'badfilename', htmlspecialchars( $this->mDestName ) ).'</li>';
                        }