(bug 20751) ForeignApiRepo does not urldecode filenames. Based on patch by Marcin...
authorChad Horohoe <demon@users.mediawiki.org>
Mon, 21 Sep 2009 01:33:06 +0000 (01:33 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Mon, 21 Sep 2009 01:33:06 +0000 (01:33 +0000)
RELEASE-NOTES
includes/filerepo/ForeignAPIRepo.php

index e95dd3e..b3ba594 100644 (file)
@@ -520,6 +520,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   by disable_functions
 * (bug 20726) Title::getLatestRevID's documentation now says that the function
   returns false if the page doesn't exist
+* (bug 20751) ForeignApiRepo now urldecodes filenames when saving to local cache
 
 == API changes in 1.16 ==
 
index a569fa5..84e5df6 100644 (file)
@@ -188,7 +188,7 @@ class ForeignAPIRepo extends FileRepo {
                        $foreignUrl = $this->getThumbUrl( $name, $width, $height );
                        
                        // We need the same filename as the remote one :)
-                       $fileName = ltrim( substr( $foreignUrl, strrpos( $foreignUrl, '/' ) ), '/' );
+                       $fileName = rawurldecode( pathinfo( $foreignUrl, PATHINFO_BASENAME ) );
                        $path = 'thumb/' . $this->getHashPath( $name ) . $name . "/";
                        if ( !is_dir($wgUploadDirectory . '/' . $path) ) {
                                wfMkdirParents($wgUploadDirectory . '/' . $path);