From d8739c1fb6300c00337d38f3af17c699192767ba Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Jun 2024 15:48:29 +0200 Subject: [PATCH] [BUGFIX] Do not crash when moving empty folder 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: https://github.com/andersundsehr/aus_driver_amazon_s3/issues/148 --- Classes/Driver/AmazonS3Driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Driver/AmazonS3Driver.php b/Classes/Driver/AmazonS3Driver.php index 4d351a91..cbb3cd84 100644 --- a/Classes/Driver/AmazonS3Driver.php +++ b/Classes/Driver/AmazonS3Driver.php @@ -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) {