diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-06-13 11:46:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-13 11:46:05 +0200 |
commit | 794bf5b6b96adff7647e00da6018db2205991d33 (patch) | |
tree | d3a7ed74b1a085f13133233984a15e5aea047f5f /lib | |
parent | eb99de007dbfb96d60fad7edb898f73290b7b1a8 (diff) | |
parent | dbc7d3ae7c97d624e5ad3e1e58f59b911991c79b (diff) | |
download | nextcloud-server-794bf5b6b96adff7647e00da6018db2205991d33.tar.gz nextcloud-server-794bf5b6b96adff7647e00da6018db2205991d33.zip |
Merge pull request #37776 from nextcloud/backport/37534/stable26
[stable26] Adjust the value of the "max-parts" parameter of the object storage 'ListPart' interface to 1000
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 ebc8886f12d..76eee2bc962 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' => 10000 - ]); - 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 { |