diff options
author | Robin Appelman <robin@icewind.nl> | 2023-09-20 12:29:50 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2023-09-20 17:28:48 +0200 |
commit | eab8dd3ca0d7bec23894d284fba5b9b5a37d0fba (patch) | |
tree | ca57f8aeb7454073edbe75edf68aa550f0e2a5dc /lib/private | |
parent | 4ddbc55d5d1c7919ea299420283754a06ade4ddd (diff) | |
download | nextcloud-server-eab8dd3ca0d7bec23894d284fba5b9b5a37d0fba.tar.gz nextcloud-server-eab8dd3ca0d7bec23894d284fba5b9b5a37d0fba.zip |
use multipart copy for s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Files/ObjectStore/S3ObjectTrait.php | 16 |
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(); } } |