aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-10-11 16:32:54 +0200
committerGitHub <noreply@github.com>2021-10-11 16:32:54 +0200
commit0f80bc03e40dbb54497cb7d43082dc9be164755c (patch)
treebef439124ac884edb6aac5e21b99d0be50b32655 /apps
parentfc7ec1ff1b1ed6bf5229d2fb0434b0370966530e (diff)
parent09ab7a40fefea254df69217e11bf7cbfb60777e0 (diff)
downloadnextcloud-server-0f80bc03e40dbb54497cb7d43082dc9be164755c.tar.gz
nextcloud-server-0f80bc03e40dbb54497cb7d43082dc9be164755c.zip
Merge pull request #29165 from nextcloud/bug/noid/s3-delete-folder-versions
Delete S3 versions in rmdir
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index 1bdd11e39bd..a6872f1dc3e 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -311,13 +311,35 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$connection->deleteObjects([
'Bucket' => $this->bucket,
'Delete' => [
- 'Objects' => $objects['Contents']
+ 'Objects' => $objects['Contents'],
]
]);
$this->testTimeout();
}
// we reached the end when the list is no longer truncated
} while ($objects['IsTruncated']);
+
+ do {
+ // delete all contained versions and deletion markers
+ $objects = $connection->listObjectVersions($params);
+ if (isset($objects['Versions'])) {
+ $connection->deleteObjects([
+ 'Bucket' => $this->bucket,
+ 'Delete' => [
+ 'Objects' => $objects['Versions'],
+ ]
+ ]);
+ }
+ if (isset($objects['DeleteMarkers'])) {
+ $connection->deleteObjects([
+ 'Bucket' => $this->bucket,
+ 'Delete' => [
+ 'Objects' => $objects['DeleteMarkers'],
+ ]
+ ]);
+ }
+ // we reached the end when the list is no longer truncated
+ } while ($objects['IsTruncated']);
$this->deleteObject($path);
} catch (S3Exception $e) {
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);