From cdf96fab924ee2cf244d081005340b943cc157c3 Mon Sep 17 00:00:00 2001 From: Tobias Zimmerer <3228193+ir0nhide@users.noreply.github.com> Date: Thu, 9 Nov 2023 19:03:30 +0100 Subject: [PATCH] fix(s3): support SSE-C headers for the MultipartCopy call Signed-off-by: Tobias Zimmerer <3228193+ir0nhide@users.noreply.github.com> --- lib/private/Files/ObjectStore/S3ObjectTrait.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index e9c52f11936bc..217e1a1a2ff7e 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -191,6 +191,11 @@ public function objectExists($urn) { } public function copyObject($from, $to, array $options = []) { + $sourceMetadata = $this->getConnection()->headObject([ + 'Bucket' => $this->getBucket(), + 'Key' => $from, + ] + $this->getSSECParameters()); + $copy = new MultipartCopy($this->getConnection(), [ "source_bucket" => $this->getBucket(), "source_key" => $from @@ -198,7 +203,8 @@ public function copyObject($from, $to, array $options = []) { "bucket" => $this->getBucket(), "key" => $to, "acl" => "private", - "params" => $this->getSSECParameters() + $this->getSSECParameters(true) + "params" => $this->getSSECParameters() + $this->getSSECParameters(true), + "source_metadata" => $sourceMetadata ], $options)); $copy->copy(); }