aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-03-09 15:22:38 +0100
committerJulius Härtl <jus@bitgrid.net>2024-06-25 18:37:26 +0200
commitb3b567e78655dd37f7d5e91b7568a97ba1aa2fb3 (patch)
tree953269cf274aa5d3c96ede725fbfe4d9b81f485f /lib
parent61213253104cd5719c1ed9fa74935ea6be5b6719 (diff)
downloadnextcloud-server-bugfix/cleanup-s3-multipart.tar.gz
nextcloud-server-bugfix/cleanup-s3-multipart.zip
chore: Address review commentsbugfix/cleanup-s3-multipart
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php9
-rw-r--r--lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php10
-rw-r--r--lib/public/Files/Storage/IChunkedFileWrite.php5
3 files changed, 19 insertions, 5 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index 389f744eab4..3494a7db806 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -661,10 +661,6 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
return $this->objectStore->initiateMultipartUpload($urn);
}
- /**
- *
- * @throws GenericFileException
- */
public function putChunkedWritePart(
string $targetPath,
string $writeToken,
@@ -675,6 +671,11 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
if (!$this->objectStore instanceof IObjectStoreMultiPartUpload) {
throw new GenericFileException('Object store does not support multipart upload');
}
+
+ if (!is_numeric($chunkId)) {
+ throw new GenericFileException('Chunk ID must be numeric for S3 multipart upload');
+ }
+
$cacheEntry = $this->getCache()->get($targetPath);
$urn = $this->getURN($cacheEntry->getId());
diff --git a/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php b/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php
index 7989e27dfc8..c3a04da2201 100644
--- a/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php
+++ b/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
+
namespace OCP\Files\ObjectStore;
use Aws\Result;
@@ -35,6 +36,15 @@ interface IObjectStoreMultiPartUpload {
/**
* @since 26.0.0
+ * @return array of the parts in ListParts response
+ *
+ * Sample data:
+ * [[
+ * 'PartNumber' => 1,
+ * 'LastModified' => '2010-11-10T20:48:34.000Z',
+ * 'ETag' => '"7778aef83f66abc1fa1e8477f296d394"',
+ * 'Size' => 10485760,
+ * ]]
*/
public function getMultipartUploads(string $urn, string $uploadId): array;
}
diff --git a/lib/public/Files/Storage/IChunkedFileWrite.php b/lib/public/Files/Storage/IChunkedFileWrite.php
index 1095ee7cbfc..fd205ea2764 100644
--- a/lib/public/Files/Storage/IChunkedFileWrite.php
+++ b/lib/public/Files/Storage/IChunkedFileWrite.php
@@ -1,10 +1,12 @@
<?php
+
+declare(strict_types=1);
+
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-declare(strict_types=1);
namespace OCP\Files\Storage;
@@ -29,6 +31,7 @@ interface IChunkedFileWrite extends IStorage {
* @param string $chunkId
* @param resource $data
* @param int|null $size
+ * @return array|null
* @throws GenericFileException
* @since 26.0.0
*/