r88171 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88170‎ | r88171 | r88172 >
Date:12:51, 15 May 2011
Author:btongminh
Status:ok
Tags:
Comment:
(bug 23464) File: prefixes are now chopped off during uploading.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -51,6 +51,7 @@
5252 make the width be the max SVG size, not the natrual width of the SVG.
5353 * (bug 1780) Uploading files with non-ascii characters are now forbidden on
5454 Windows.
 55+* (bug 23464) File: prefixes are now chopped off during uploading.
5556
5657 === API changes in 1.19 ===
5758 * (bug 27790) add query type for querymodules to action=paraminfo
Index: trunk/phase3/includes/upload/UploadBase.php
@@ -599,13 +599,23 @@
600600 if ( $this->mTitle !== false ) {
601601 return $this->mTitle;
602602 }
 603+
 604+ /* Assume that if a user specified File:Something.jpg, this is an error
 605+ * and that the namespace prefix needs to be stripped of.
 606+ */
 607+ $title = Title::newFromText( $this->mDesiredDestName );
 608+ if ( $title->getNamespace() == NS_FILE ) {
 609+ $this->mFilteredName = $title->getDBkey();
 610+ } else {
 611+ $this->mFilteredName = $this->mDesiredDestName;
 612+ }
603613
604614 /**
605615 * Chop off any directories in the given filename. Then
606616 * filter out illegal characters, and try to make a legible name
607617 * out of it. We'll strip some silently that Title would die on.
608618 */
609 - $this->mFilteredName = wfStripIllegalFilenameChars( $this->mDesiredDestName );
 619+ $this->mFilteredName = wfStripIllegalFilenameChars( $this->mFilteredName );
610620 /* Normalize to title form before we do any further processing */
611621 $nt = Title::makeTitleSafe( NS_FILE, $this->mFilteredName );
612622 if( is_null( $nt ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r94601follow-up r88171 - fix fatal if suggested filename has illegal character in it....bawolff05:37, 16 August 2011

Status & tagging log