diff options
author | tomneedham <tom@owncloud.com> | 2013-11-14 01:21:54 +0000 |
---|---|---|
committer | tomneedham <tom@owncloud.com> | 2013-11-14 01:21:54 +0000 |
commit | 1449437c9ec2e1ad9a58ba12abd9a3b27d8e39f1 (patch) | |
tree | 0883fffb56aa489851320d9b08da12ec8d1e7605 /lib/private/api.php | |
parent | bb182bbfb2d77a565e758e9478be285a3be999a3 (diff) | |
download | nextcloud-server-1449437c9ec2e1ad9a58ba12abd9a3b27d8e39f1.tar.gz nextcloud-server-1449437c9ec2e1ad9a58ba12abd9a3b27d8e39f1.zip |
Merge multiple failed third party responses when returning the result
Diffstat (limited to 'lib/private/api.php')
-rw-r--r-- | lib/private/api.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/private/api.php b/lib/private/api.php index 3df2095ad4f..03d7b7382a5 100644 --- a/lib/private/api.php +++ b/lib/private/api.php @@ -177,9 +177,16 @@ class OC_API { } elseif(!empty($shipped['succeeded'])) { $responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']); } elseif(!empty($thirdparty['failed'])) { - // Return the third party failure result - $response = reset($thirdparty['failed']); - return $response['response']; + // Merge failed responses if more than one + $data = array(); + $meta = array(); + foreach($thirdparty['failed'] as $failure) { + $data = array_merge_recursive($data, $failure['response']->getData()); + } + $picked = reset($thirdparty['failed']); + $code = $picked['response']->getStatusCode(); + $response = new OC_OCS_Result($data, $code); + return $response; } else { $responses = $thirdparty['succeeded']; } |