http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88171
Revision: 88171
Author: btongminh
Date: 2011-05-15 12:51:52 +0000 (Sun, 15 May 2011)
Log Message:
-----------
(bug 23464) File: prefixes are now chopped off during uploading.
Modified Paths:
--------------
trunk/phase3/RELEASE-NOTES-1.19
trunk/phase3/includes/upload/UploadBase.php
Modified: trunk/phase3/RELEASE-NOTES-1.19
===================================================================
--- trunk/phase3/RELEASE-NOTES-1.19 2011-05-15 12:48:34 UTC (rev 88170)
+++ trunk/phase3/RELEASE-NOTES-1.19 2011-05-15 12:51:52 UTC (rev 88171)
@@ -51,6 +51,7 @@
make the width be the max SVG size, not the natrual width of the SVG.
* (bug 1780) Uploading files with non-ascii characters are now forbidden on
Windows.
+* (bug 23464) File: prefixes are now chopped off during uploading.
=== API changes in 1.19 ===
* (bug 27790) add query type for querymodules to action=paraminfo
Modified: trunk/phase3/includes/upload/UploadBase.php
===================================================================
--- trunk/phase3/includes/upload/UploadBase.php 2011-05-15 12:48:34 UTC (rev
88170)
+++ trunk/phase3/includes/upload/UploadBase.php 2011-05-15 12:51:52 UTC (rev
88171)
@@ -599,13 +599,23 @@
if ( $this->mTitle !== false ) {
return $this->mTitle;
}
+
+ /* Assume that if a user specified File:Something.jpg, this is
an error
+ * and that the namespace prefix needs to be stripped of.
+ */
+ $title = Title::newFromText( $this->mDesiredDestName );
+ if ( $title->getNamespace() == NS_FILE ) {
+ $this->mFilteredName = $title->getDBkey();
+ } else {
+ $this->mFilteredName = $this->mDesiredDestName;
+ }
/**
* Chop off any directories in the given filename. Then
* filter out illegal characters, and try to make a legible name
* out of it. We'll strip some silently that Title would die on.
*/
- $this->mFilteredName = wfStripIllegalFilenameChars(
$this->mDesiredDestName );
+ $this->mFilteredName = wfStripIllegalFilenameChars(
$this->mFilteredName );
/* Normalize to title form before we do any further processing
*/
$nt = Title::makeTitleSafe( NS_FILE, $this->mFilteredName );
if( is_null( $nt ) ) {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs