Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -399,15 +399,20 @@ |
400 | 400 | $basename = $this->mSrcName; |
401 | 401 | } |
402 | 402 | $filtered = wfStripIllegalFilenameChars( $basename ); |
403 | | - |
| 403 | + |
| 404 | + $nt = Title::makeTitleSafe( NS_FILE, $filtered ); |
| 405 | + if( is_null( $nt ) ) { |
| 406 | + $resultDetails = array( 'filtered' => $filtered ); |
| 407 | + return self::ILLEGAL_FILENAME; |
| 408 | + } |
404 | 409 | /** |
405 | 410 | * We'll want to blacklist against *any* 'extension', and use |
406 | 411 | * only the final one for the whitelist. |
407 | 412 | */ |
408 | | - list( $partname, $ext ) = $this->splitExtensions( $filtered ); |
| 413 | + list( $partname, $ext ) = $this->splitExtensions( $nt->getDBkey() ); |
409 | 414 | |
410 | 415 | if( count( $ext ) ) { |
411 | | - $finalExt = trim( $ext[count( $ext ) - 1] ); |
| 416 | + $finalExt = $ext[count( $ext ) - 1]; |
412 | 417 | } else { |
413 | 418 | $finalExt = ''; |
414 | 419 | } |
— | — | @@ -423,11 +428,6 @@ |
424 | 429 | return self::MIN_LENGHT_PARTNAME; |
425 | 430 | } |
426 | 431 | |
427 | | - $nt = Title::makeTitleSafe( NS_FILE, $filtered ); |
428 | | - if( is_null( $nt ) ) { |
429 | | - $resultDetails = array( 'filtered' => $filtered ); |
430 | | - return self::ILLEGAL_FILENAME; |
431 | | - } |
432 | 432 | $this->mLocalFile = wfLocalFile( $nt ); |
433 | 433 | $this->mDestName = $this->mLocalFile->getName(); |
434 | 434 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -451,6 +451,8 @@ |
452 | 452 | redirectedfrom, historywarning and difference messages now use Wiki text |
453 | 453 | rather than raw HTML markup |
454 | 454 | * (bug 13835) Fix rendering of {{filepath:Wiki.png|nowiki}} |
| 455 | +* (bug 16772) Special:Upload now correctly rejects files with spaces in the |
| 456 | + file extension (e.g. Foo. jpg). |
455 | 457 | |
456 | 458 | === API changes in 1.14 === |
457 | 459 | |