Skip to content

Commit 5e20f72

Browse files
author
Jamie Hannaford
authored
Merge pull request #134 from php-opencloud/fix-object-storage-stream
[rfr] Fixed stream pointer pointing to end of stream
2 parents 8369248 + c085cde commit 5e20f72

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/ObjectStore/v1/Models/Object.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ public function populateFromResponse(ResponseInterface $response): self
5151
{
5252
parent::populateFromResponse($response);
5353

54+
$this->populateHeaders($response);
55+
56+
return $this;
57+
}
58+
59+
/**
60+
* @param ResponseInterface $response
61+
*
62+
* @return $this
63+
*/
64+
private function populateHeaders(ResponseInterface $response): self
65+
{
5466
$this->hash = $response->getHeaderLine('ETag');
5567
$this->contentLength = $response->getHeaderLine('Content-Length');
5668
$this->lastModified = $response->getHeaderLine('Last-Modified');
@@ -100,8 +112,9 @@ public function retrieve()
100112
*/
101113
public function download(): StreamInterface
102114
{
115+
/** @var ResponseInterface $response */
103116
$response = $this->executeWithState($this->api->getObject());
104-
$this->populateFromResponse($response);
117+
$this->populateHeaders($response);
105118
return $response->getBody();
106119
}
107120

0 commit comments

Comments
 (0)