diff options
author | Rsplwe <i@rsplwe.com> | 2023-04-01 22:56:15 +0800 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-04-17 22:23:19 +0000 |
commit | a69ae912fa8ed6f0e8a1ec8d0995cc4fb99ec2e1 (patch) | |
tree | c8d2e96636966063ecfa92690f98801f7efd0e7f /lib | |
parent | 5108e7b68f6db67a0e3af089be44bd770145466a (diff) | |
download | nextcloud-server-a69ae912fa8ed6f0e8a1ec8d0995cc4fb99ec2e1.tar.gz nextcloud-server-a69ae912fa8ed6f0e8a1ec8d0995cc4fb99ec2e1.zip |
s3: get remaining truncation part
Signed-off-by: Rsplwe <i@rsplwe.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/ObjectStore/S3.php | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/private/Files/ObjectStore/S3.php b/lib/private/Files/ObjectStore/S3.php index 964d82ec581..e760b8b1572 100644 --- a/lib/private/Files/ObjectStore/S3.php +++ b/lib/private/Files/ObjectStore/S3.php @@ -69,13 +69,24 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload { } public function getMultipartUploads(string $urn, string $uploadId): array { - $parts = $this->getConnection()->listParts([ - 'Bucket' => $this->bucket, - 'Key' => $urn, - 'UploadId' => $uploadId, - 'MaxParts' => 1000 - ]); - return $parts->get('Parts') ?? []; + $parts = []; + $isTruncated = true; + $partNumberMarker = 0; + + while ($isTruncated) { + $result = $this->getConnection()->listParts([ + 'Bucket' => $this->bucket, + 'Key' => $urn, + 'UploadId' => $uploadId, + 'MaxParts' => 1000, + 'PartNumberMarker' => $partNumberMarker + ]); + $parts = array_merge($parts, $result->get('Parts')); + $isTruncated = $result->get('IsTruncated'); + $partNumberMarker = $result->get('NextPartNumberMarker'); + } + + return $parts; } public function completeMultipartUpload(string $urn, string $uploadId, array $result): int { |