Skip to content

Commit

Permalink
[BUGFIX] Do not crash when moving empty folder
Browse files Browse the repository at this point in the history
At least MinIO's list response does not contain a 'Content' property
when a folder has no child elements.

When moving a folder, check for its existence before iterating over it.

Resolves: #148
  • Loading branch information
cweiske committed Jun 18, 2024
1 parent 5dcf086 commit d8739c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Classes/Driver/AmazonS3Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ protected function resetIdentifierMap()
protected function getSubObjects($identifier, $recursive = true, $filter = self::FILTER_ALL)
{
$result = $this->getListObjects($identifier);
if (!is_array($result['Contents'])) {
if (!is_array($result['Contents'] ?? null)) {
return [];
}
return array_filter($result['Contents'], function (&$object) use ($identifier, $recursive, $filter) {
Expand Down

0 comments on commit d8739c1

Please sign in to comment.