Skip to content

Commit 3a44e43

Browse files
authored
Merge pull request #56505 from nextcloud/backport/56366/stable32
[stable32] fix: pass only necessary information when deleting mulitple objects
2 parents d3571aa + 82f9a1b commit 3a44e43

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

apps/files_external/lib/Lib/Storage/AmazonS3.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,16 @@ private function batchDelete(?string $path = null): bool {
263263
// to delete all objects prefixed with the path.
264264
do {
265265
// instead of the iterator, manually loop over the list ...
266-
$objects = $connection->listObjects($params);
266+
$objects = $connection->listObjectsV2($params);
267267
// ... so we can delete the files in batches
268268
if (isset($objects['Contents'])) {
269269
$connection->deleteObjects([
270270
'Bucket' => $this->bucket,
271271
'Delete' => [
272-
'Objects' => $objects['Contents']
272+
'Objects' => array_map(fn (array $object) => [
273+
'ETag' => $object['ETag'],
274+
'Key' => $object['Key'],
275+
], $objects['Contents'])
273276
]
274277
]);
275278
$this->testTimeout();

0 commit comments

Comments
 (0)