Skip to content

Commit

Permalink
Merge pull request #134 from php-opencloud/fix-object-storage-stream
Browse files Browse the repository at this point in the history
[rfr] Fixed stream pointer pointing to end of stream
  • Loading branch information
Jamie Hannaford committed Jul 20, 2017
2 parents 8369248 + c085cde commit 5e20f72
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/ObjectStore/v1/Models/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ public function populateFromResponse(ResponseInterface $response): self
{
parent::populateFromResponse($response);

$this->populateHeaders($response);

return $this;
}

/**
* @param ResponseInterface $response
*
* @return $this
*/
private function populateHeaders(ResponseInterface $response): self
{
$this->hash = $response->getHeaderLine('ETag');
$this->contentLength = $response->getHeaderLine('Content-Length');
$this->lastModified = $response->getHeaderLine('Last-Modified');
Expand Down Expand Up @@ -100,8 +112,9 @@ public function retrieve()
*/
public function download(): StreamInterface
{
/** @var ResponseInterface $response */
$response = $this->executeWithState($this->api->getObject());
$this->populateFromResponse($response);
$this->populateHeaders($response);
return $response->getBody();
}

Expand Down

0 comments on commit 5e20f72

Please sign in to comment.