]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge multiple failed third party responses when returning the result
authortomneedham <tom@owncloud.com>
Thu, 14 Nov 2013 01:21:54 +0000 (01:21 +0000)
committertomneedham <tom@owncloud.com>
Thu, 14 Nov 2013 01:21:54 +0000 (01:21 +0000)
lib/private/api.php

index 3df2095ad4f9fc7881f7c41a0ff7260171ff1ddc..03d7b7382a5592c8f23e19c0d81cc8896649734e 100644 (file)
@@ -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'];
                }