Merge pull request #56366 from nextcloud/leftybournes/fix/s3_delete_folders

fix: pass only necessary information when deleting mulitple objects
This commit is contained in:
Stephan Orbaugh 2025-11-18 09:48:12 +01:00 committed by GitHub
commit ba9fe489a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -263,13 +263,16 @@ class AmazonS3 extends Common {
// 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();