From bb8a0e81a6cdab1c812e337ec76fac06e04873ad Mon Sep 17 00:00:00 2001 From: Eric Vachaviolos Date: Thu, 14 Jul 2016 12:42:16 -0400 Subject: [PATCH] Fix UploadObject not returning Etag and ContentType Container::setContent() is resetting both Etag and ContentType so I moved this call before the Container::populateFromResponse() call in order to get those values from the headers. --- lib/OpenCloud/ObjectStore/Resource/Container.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/OpenCloud/ObjectStore/Resource/Container.php b/lib/OpenCloud/ObjectStore/Resource/Container.php index 474d9134b..de5cad1fc 100644 --- a/lib/OpenCloud/ObjectStore/Resource/Container.php +++ b/lib/OpenCloud/ObjectStore/Resource/Container.php @@ -453,9 +453,9 @@ public function uploadObject($name, $data, array $headers = array()) $response = $this->getClient()->put($url, $headers, $entityBody)->send(); return $this->dataObject() + ->setContent($entityBody) ->populateFromResponse($response) - ->setName($name) - ->setContent($entityBody); + ->setName($name); } /** @@ -524,9 +524,9 @@ public function uploadObjects(array $files, array $commonHeaders = array(), $ret $dataObjects = array(); foreach ($responses as $index => $response) { $dataObjects[] = $this->dataObject() + ->setContent($entities[$index]) ->populateFromResponse($response) - ->setName($files[$index]['name']) - ->setContent($entities[$index]); + ->setName($files[$index]['name']); } return $dataObjects; }