r24241 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24240‎ | r24241 | r24242 >
Date:16:04, 18 July 2007
Author:raymond
Status:old
Tags:
Comment:
* (bug 10631) Warn when illegal characters are removed from filename at upload
Probably a regression, I am sure I have seen this warning in the past
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialUpload.php
@@ -284,16 +284,17 @@
285285
286286 # Chop off any directories in the given filename
287287 if( $this->mDesiredDestName ) {
288 - $basename = wfBaseName( $this->mDesiredDestName );
 288+ $basename = $this->mDesiredDestName;
289289 } else {
290 - $basename = wfBaseName( $this->mSrcName );
 290+ $basename = $this->mSrcName;
291291 }
 292+ $filtered = wfBaseName( $basename );
292293
293294 /**
294295 * We'll want to blacklist against *any* 'extension', and use
295296 * only the final one for the whitelist.
296297 */
297 - list( $partname, $ext ) = $this->splitExtensions( $basename );
 298+ list( $partname, $ext ) = $this->splitExtensions( $filtered );
298299
299300 if( count( $ext ) ) {
300301 $finalExt = $ext[count( $ext ) - 1];
@@ -317,7 +318,7 @@
318319 * Filter out illegal characters, and try to make a legible name
319320 * out of it. We'll strip some silently that Title would die on.
320321 */
321 - $filtered = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $basename );
 322+ $filtered = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $filtered );
322323 $nt = Title::makeTitleSafe( NS_IMAGE, $filtered );
323324 if( is_null( $nt ) ) {
324325 $this->uploadError( wfMsgWikiHtml( 'illegalfilename', htmlspecialchars( $filtered ) ) );
@@ -388,7 +389,7 @@
389390 if( $wgCapitalLinks ) {
390391 $filtered = ucfirst( $filtered );
391392 }
392 - if( $this->mDestName != $filtered ) {
 393+ if( $basename != $filtered ) {
393394 $warning .= '<li>'.wfMsgHtml( 'badfilename', htmlspecialchars( $this->mDestName ) ).'</li>';
394395 }
395396
Index: trunk/phase3/RELEASE-NOTES
@@ -315,8 +315,8 @@
316316 * (bug 10615) Fix for transwiki import when CURL not available
317317 * (bug 8054) Return search page for empty search requests with ugly URLs
318318 * (bug 10572) Force refresh after clearing visitation timestamps on watchlist
 319+* (bug 10631) Warn when illegal characters are removed from filename at upload
319320
320 -
321321 == API changes since 1.10 ==
322322
323323 Full API documentation is available at http://www.mediawiki.org/wiki/API

Follow-up revisions

RevisionCommit summaryAuthorDate
r24276Merged revisions 24213-24275 via svnmerge from...david20:20, 19 July 2007

Status & tagging log