From: rillke Date: Sat, 10 Aug 2013 12:14:03 +0000 (+0200) Subject: Return normalized file name on warning "exists-normalized" X-Git-Tag: 1.31.0-rc.0~18798 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=07c61c796b6ed0cee89041f8276ea2c5540b22cb;p=lhc%2Fweb%2Fwiklou.git Return normalized file name on warning "exists-normalized" Make API action=upload return normalized file name on warning "exists-normalized" instead of filename to be uploaded to. This enables humans to see which file the current upload conflicts with. There is no point in returning the filename the upload should go to because the client that makes the request is usually aware of this. Bug: 52699 Change-Id: I898b7f234d43eb1e524952f6de80e401a8c96671 --- diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index 8cdb985225..e503e30195 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -345,6 +345,8 @@ production. * Support for the 'gettoken' parameter to action=block and action=unblock, deprecated since 1.20, has been removed. * (bug 49090) Token-getting functions will fail when using jsonp callbacks. +* (bug 52699) action=upload returns normalized file name on warning + "exists-normalized" instead of filename to be uploaded to. === Languages updated in 1.22=== diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index b903a62811..6f6b08010b 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -565,7 +565,8 @@ class ApiUpload extends ApiBase { if ( isset( $warnings['exists'] ) ) { $warning = $warnings['exists']; unset( $warnings['exists'] ); - $warnings[$warning['warning']] = $warning['file']->getName(); + $localFile = isset( $warning['normalizedFile'] ) ? $warning['normalizedFile'] : $warning['file']; + $warnings[$warning['warning']] = $localFile->getName(); } } return $warnings;