Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -51,6 +51,7 @@ |
52 | 52 | make the width be the max SVG size, not the natrual width of the SVG. |
53 | 53 | * (bug 1780) Uploading files with non-ascii characters are now forbidden on |
54 | 54 | Windows. |
| 55 | +* (bug 23464) File: prefixes are now chopped off during uploading. |
55 | 56 | |
56 | 57 | === API changes in 1.19 === |
57 | 58 | * (bug 27790) add query type for querymodules to action=paraminfo |
Index: trunk/phase3/includes/upload/UploadBase.php |
— | — | @@ -599,13 +599,23 @@ |
600 | 600 | if ( $this->mTitle !== false ) { |
601 | 601 | return $this->mTitle; |
602 | 602 | } |
| 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 | + } |
603 | 613 | |
604 | 614 | /** |
605 | 615 | * Chop off any directories in the given filename. Then |
606 | 616 | * filter out illegal characters, and try to make a legible name |
607 | 617 | * out of it. We'll strip some silently that Title would die on. |
608 | 618 | */ |
609 | | - $this->mFilteredName = wfStripIllegalFilenameChars( $this->mDesiredDestName ); |
| 619 | + $this->mFilteredName = wfStripIllegalFilenameChars( $this->mFilteredName ); |
610 | 620 | /* Normalize to title form before we do any further processing */ |
611 | 621 | $nt = Title::makeTitleSafe( NS_FILE, $this->mFilteredName ); |
612 | 622 | if( is_null( $nt ) ) { |