aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/ObjectStore
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-09-20 12:29:50 +0200
committerRobin Appelman <robin@icewind.nl>2023-09-22 10:42:07 +0200
commit22556a67a8bec293c898c42f4c7020b606dd1bea (patch)
treecfd30d756d6cc45f5c20da2eca263e67504dc6db /lib/private/Files/ObjectStore
parent0acad69840ff21a103f532548907e480fc5a982a (diff)
downloadnextcloud-server-22556a67a8bec293c898c42f4c7020b606dd1bea.tar.gz
nextcloud-server-22556a67a8bec293c898c42f4c7020b606dd1bea.zip
use multipart copy for s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/ObjectStore')
-rw-r--r--lib/private/Files/ObjectStore/S3ObjectTrait.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php
index e0d0f2ce9c7..e9c52f11936 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -27,6 +27,7 @@
namespace OC\Files\ObjectStore;
use Aws\S3\Exception\S3MultipartUploadException;
+use Aws\S3\MultipartCopy;
use Aws\S3\MultipartUploader;
use Aws\S3\S3Client;
use GuzzleHttp\Psr7;
@@ -189,9 +190,16 @@ trait S3ObjectTrait {
return $this->getConnection()->doesObjectExist($this->bucket, $urn, $this->getSSECParameters());
}
- public function copyObject($from, $to) {
- $this->getConnection()->copy($this->getBucket(), $from, $this->getBucket(), $to, 'private', [
- 'params' => $this->getSSECParameters() + $this->getSSECParameters(true)
- ]);
+ public function copyObject($from, $to, array $options = []) {
+ $copy = new MultipartCopy($this->getConnection(), [
+ "source_bucket" => $this->getBucket(),
+ "source_key" => $from
+ ], array_merge([
+ "bucket" => $this->getBucket(),
+ "key" => $to,
+ "acl" => "private",
+ "params" => $this->getSSECParameters() + $this->getSSECParameters(true)
+ ], $options));
+ $copy->copy();
}
}