From 305179ffa3d141973d5ddb31261d8e1730c18684 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Sat, 15 Aug 2009 10:22:20 +0000 Subject: [PATCH] * added missing setIndexedTagName for some upload api array results * switched apiFormatJson output from 'application/json' to 'text/javascript' --- includes/api/ApiFormatJson.php | 2 +- includes/api/ApiUpload.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index cf1f16cebd..1d7e3dccd3 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -41,7 +41,7 @@ class ApiFormatJson extends ApiFormatBase { } public function getMimeType() { - return 'application/json'; + return 'text/javascript'; } public function getNeedsRawData() { diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 62ff21aa72..57f3541f4d 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -237,7 +237,13 @@ class ApiUpload extends ApiBase { $warnings = $this->mUpload->checkWarnings(); if( $warnings ) { $this->getResult()->setIndexedTagName( $warnings, 'warning' ); - + //also add index to duplicate: + if(isset($warnings['duplicate'])) + $this->getResult()->setIndexedTagName( $warnings['duplicate'], 'duplicate'); + + if(isset($warnings['exists'])) + $this->getResult()->setIndexedTagName( $warnings['exists'], 'exists'); + $result['result'] = 'Warning'; $result['warnings'] = $warnings; if( isset( $result['filewasdeleted'] ) ) -- 2.20.1