From 7806ec12c8233f9d744b188af9615477b013b872 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 21 Sep 2009 01:33:06 +0000 Subject: [PATCH] =?utf8?q?(bug=2020751)=20ForeignApiRepo=20does=20not=20ur?= =?utf8?q?ldecode=20filenames.=20Based=20on=20patch=20by=20Marcin=20Cie?= =?utf8?q?=C5=9Blak.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- RELEASE-NOTES | 1 + includes/filerepo/ForeignAPIRepo.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e95dd3e9a3..b3ba594b60 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index a569fa5f9b..84e5df6989 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -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); -- 2.20.1