Skip to content

Commit

Permalink
Merge pull request #544 from KnpLabs/fix/awss3-count
Browse files Browse the repository at this point in the history
Quickfix for Adapter/AwsS3, check if count() call is allowed.
  • Loading branch information
nicolasmure authored Jan 4, 2018
2 parents 42cf3a0 + 57f6b15 commit ee582de
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Gaufrette/Adapter/AwsS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,13 @@ public function isDirectory($key)
'Prefix' => rtrim($this->computePath($key), '/').'/',
'MaxKeys' => 1,
]);
if (isset($result['Contents'])) {
if (is_array($result['Contents']) || $result['Contents'] instanceof \Countable) {
return count($result['Contents']) > 0;
}
}

return count($result['Contents']) > 0;
return false;
}

/**
Expand Down

0 comments on commit ee582de

Please sign in to comment.