mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix: pass only necessary information when deleting mulitple objects
DeleteObjects currently fails when the request includes all the information returned by ListObjects. Send only the necessary information in the request. Note: 'Size' and 'DateModified' is now only supported by directory buckets. Signed-off-by: Kent Delante <kent.delante@proton.me>
This commit is contained in:
parent
83a0e8a7a5
commit
b57db10814
1 changed files with 5 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue