]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge multiple shipped failures before responding.
authortomneedham <tom@owncloud.com>
Thu, 14 Nov 2013 01:19:46 +0000 (01:19 +0000)
committertomneedham <tom@owncloud.com>
Thu, 14 Nov 2013 01:19:46 +0000 (01:19 +0000)
lib/private/api.php

index 8ff6c3e7eeb5ce9cd8a672e207b2d6f4ab96c435..3df2095ad4f9fc7881f7c41a0ff7260171ff1ddc 100644 (file)
@@ -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'])) {