Skip to content

Commit

Permalink
fix: attempt to only remember received content when the header is in …
Browse files Browse the repository at this point in the history
…correct status
  • Loading branch information
indreka committed Jan 6, 2025
1 parent 06bd1bb commit f6f7d71
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Storage/src/Connection/Rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,12 @@ public function downloadObject(array $args = [])
&$attempt,
) {
// if the exception has a response for us to use
if ($e instanceof RequestException && $e->hasResponse()) {
if (
$e instanceof RequestException
&& $e->hasResponse()
&& $e->getResponse()->getStatusCode() >= 200
&& $e->getResponse()->getStatusCode() < 300
) {
$msg = (string) $e->getResponse()->getBody();

$fetchedStream = Utils::streamFor($msg);
Expand Down

0 comments on commit f6f7d71

Please sign in to comment.