diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 5dc9e11453213..1e834811bd18f 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -263,13 +263,16 @@ private function batchDelete(?string $path = null): bool { // to delete all objects prefixed with the path. do { // instead of the iterator, manually loop over the list ... - $objects = $connection->listObjects($params); + $objects = $connection->listObjectsV2($params); // ... so we can delete the files in batches if (isset($objects['Contents'])) { $connection->deleteObjects([ 'Bucket' => $this->bucket, 'Delete' => [ - 'Objects' => $objects['Contents'] + 'Objects' => array_map(fn (array $object) => [ + 'ETag' => $object['ETag'], + 'Key' => $object['Key'], + ], $objects['Contents']) ] ]); $this->testTimeout();