Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
  • Loading branch information
leftybournes authored and backportbot[bot] committed Nov 18, 2025
commit 82f9a1b64ef487e91cf9b089c199e820dd0ef8b9
7 changes: 5 additions & 2 deletions apps/files_external/lib/Lib/Storage/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading