diff options
author | Julius Härtl <jus@bitgrid.net> | 2023-10-10 19:22:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 19:22:53 +0200 |
commit | 1f4fffc258ba71ec6e18b7f3b94056b15d7874d1 (patch) | |
tree | 5919aec7d865ee72cb59fd229a54a399147d4729 /lib | |
parent | b2c864d6093ff02869e99557abe1e8738230220d (diff) | |
parent | 22556a67a8bec293c898c42f4c7020b606dd1bea (diff) | |
download | nextcloud-server-1f4fffc258ba71ec6e18b7f3b94056b15d7874d1.tar.gz nextcloud-server-1f4fffc258ba71ec6e18b7f3b94056b15d7874d1.zip |
Merge pull request #40577 from nextcloud/s3-multipart-copy-27
Diffstat (limited to 'lib')
-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(); } } |