diff options
author | Tom Needham <needham.thomas@gmail.com> | 2013-05-02 15:40:10 -0700 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2013-05-02 15:40:10 -0700 |
commit | cb5a69dd2246adcd1f8f722fc7946070ed293d63 (patch) | |
tree | 30a7f6d3da47ef2f9d8bb9d096e51d258f879271 /lib | |
parent | 444a209a2a45c27675a1c754e4b6b2f039be1276 (diff) | |
parent | 11afb2e5a80bb29a48717b0a9b6a9e034fd55497 (diff) | |
download | nextcloud-server-cb5a69dd2246adcd1f8f722fc7946070ed293d63.tar.gz nextcloud-server-cb5a69dd2246adcd1f8f722fc7946070ed293d63.zip |
Merge pull request #3216 from owncloud/fix-api-3rdparty
fix bug that would only return error responses for 3rdparty apps
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/api.php b/lib/api.php index 249d7a90350..fc76836995b 100644 --- a/lib/api.php +++ b/lib/api.php @@ -111,9 +111,11 @@ class OC_API { } $response = self::mergeResponses($responses); $formats = array('json', 'xml'); + $format = !empty($_GET['format']) && in_array($_GET['format'], $formats) ? $_GET['format'] : 'xml'; - self::respond($response); OC_User::logout(); + + self::respond($response, $format); } /** @@ -147,6 +149,7 @@ class OC_API { } } } + // Remove any error responses if there is one shipped response that succeeded if(!empty($shipped['succeeded'])) { $responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']); @@ -157,14 +160,17 @@ class OC_API { // Maybe any that are not OC_API::RESPOND_SERVER_ERROR $response = reset($shipped['failed']); return $response; - } else { + } elseif(!empty($thirdparty['failed'])) { // Return the third party failure result $response = reset($thirdparty['failed']); return $response; + } else { + $responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']); } // Merge the successful responses $meta = array(); $data = array(); + foreach($responses as $app => $response) { if(OC_App::isShipped($app)) { $data = array_merge_recursive($response->getData(), $data); |