diff options
author | tomneedham <tom@owncloud.com> | 2013-11-14 01:19:46 +0000 |
---|---|---|
committer | tomneedham <tom@owncloud.com> | 2013-11-14 01:19:46 +0000 |
commit | bb182bbfb2d77a565e758e9478be285a3be999a3 (patch) | |
tree | f82ee8f8ae1d05fb510910b016d9a0b17256e36f /lib/private/api.php | |
parent | ca5c39a3a1ff624a0bbcb39456c93856b8983b51 (diff) | |
download | nextcloud-server-bb182bbfb2d77a565e758e9478be285a3be999a3.tar.gz nextcloud-server-bb182bbfb2d77a565e758e9478be285a3be999a3.zip |
Merge multiple shipped failures before responding.
Diffstat (limited to 'lib/private/api.php')
-rw-r--r-- | lib/private/api.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/private/api.php b/lib/private/api.php index 8ff6c3e7eeb..3df2095ad4f 100644 --- a/lib/private/api.php +++ b/lib/private/api.php @@ -164,8 +164,16 @@ class OC_API { // They may have failed for different reasons (different status codes) // Which reponse code should we return? // Maybe any that are not OC_API::RESPOND_SERVER_ERROR - $response = reset($shipped['failed']); - return $response['response']; + // Merge failed responses if more than one + $data = array(); + $meta = array(); + foreach($shipped['failed'] as $failure) { + $data = array_merge_recursive($data, $failure['response']->getData()); + } + $picked = reset($shipped['failed']); + $code = $picked['response']->getStatusCode(); + $response = new OC_OCS_Result($data, $code); + return $response; } elseif(!empty($shipped['succeeded'])) { $responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']); } elseif(!empty($thirdparty['failed'])) { |