From b40fa64a8bdab16e9241379bdb909fae958c0910 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 20 Sep 2023 12:29:50 +0200 Subject: [PATCH 1/2] use multipart copy for s3 Signed-off-by: Robin Appelman --- apps/files_external/lib/Lib/Storage/AmazonS3.php | 5 +---- lib/private/Files/ObjectStore/S3ObjectTrait.php | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 3d982bdab0232..e9398815055bd 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -580,10 +580,7 @@ public function copy($source, $target, $isFile = null) { if ($isFile === true || $this->is_file($source)) { try { - $this->getConnection()->copyObject([ - 'Bucket' => $this->bucket, - 'Key' => $this->cleanKey($target), - 'CopySource' => S3Client::encodeKey($this->bucket . '/' . $source), + $this->copyObject($source, $target, [ 'StorageClass' => $this->storageClass, ]); $this->testTimeout(); diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index e0d0f2ce9c7e8..e9c52f11936bc 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 @@ public function objectExists($urn) { 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(); } } From 0a8b7b28941f5fe76ba05a2d04b723a96199b04f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 20 Sep 2023 17:31:49 +0200 Subject: [PATCH 2/2] try to make kerberos test more reliable Signed-off-by: Robin Appelman --- .github/workflows/smb-kerberos.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/smb-kerberos.yml b/.github/workflows/smb-kerberos.yml index 519b1ce3700b3..3c8e9ed843179 100644 --- a/.github/workflows/smb-kerberos.yml +++ b/.github/workflows/smb-kerberos.yml @@ -41,6 +41,7 @@ jobs: - name: Setup AD-DC run: | DC_IP=$(apps/files_external/tests/sso-setup/start-dc.sh) + sleep 1 apps/files_external/tests/sso-setup/start-apache.sh $DC_IP $PWD echo "DC_IP=$DC_IP" >> $GITHUB_ENV - name: Set up Nextcloud