Rillke has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/78523


Change subject: Return normalized file name on warning "exists-normalized"
......................................................................

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
---
M RELEASE-NOTES-1.22
M includes/api/ApiUpload.php
2 files changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/23/78523/1

diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index af467a0..93445ca 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -304,6 +304,8 @@
   version of the title.
 * (bug 52538) action=edit will now use empty text instead of the contents
   of section 0 when passed prependtext or appendtext with section=new.
+* (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 b903a62..cd59563 100644
--- a/includes/api/ApiUpload.php
+++ b/includes/api/ApiUpload.php
@@ -565,7 +565,8 @@
                        if ( isset( $warnings['exists'] ) ) {
                                $warning = $warnings['exists'];
                                unset( $warnings['exists'] );
-                               $warnings[$warning['warning']] = 
$warning['file']->getName();
+                               $fileName = isset( $warning['normalizedFile'] ) 
? $warning['normalizedFile'] : $warning['file'];
+                               $warnings[$warning['warning']] = 
$fileName->getName();
                        }
                }
                return $warnings;

-- 
To view, visit https://gerrit.wikimedia.org/r/78523
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I898b7f234d43eb1e524952f6de80e401a8c96671
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Rillke <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to