]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(s3): Add config option to disable multipart copy for certain s3 providers 42521/head
authorJulius Härtl <jus@bitgrid.net>
Thu, 28 Dec 2023 14:31:08 +0000 (15:31 +0100)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Fri, 29 Dec 2023 10:36:09 +0000 (10:36 +0000)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/Files/ObjectStore/S3ConnectionTrait.php
lib/private/Files/ObjectStore/S3ObjectTrait.php

index 1a682567e0c903242adb59b646f1fc82f7153078..a1edfa1eb99eb12d12d5d3f6b103577f7a7adeaa 100644 (file)
@@ -74,6 +74,8 @@ trait S3ConnectionTrait {
        /** @var int */
        private $copySizeLimit;
 
+       private bool $useMultipartCopy = true;
+
        protected $test;
 
        protected function parseParams($params) {
@@ -91,6 +93,7 @@ trait S3ConnectionTrait {
                $this->uploadPartSize = $params['uploadPartSize'] ?? 524288000;
                $this->putSizeLimit = $params['putSizeLimit'] ?? 104857600;
                $this->copySizeLimit = $params['copySizeLimit'] ?? 5242880000;
+               $this->useMultipartCopy = (bool)($params['useMultipartCopy'] ?? true);
                $params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region'];
                $params['hostname'] = empty($params['hostname']) ? 's3.' . $params['region'] . '.amazonaws.com' : $params['hostname'];
                if (!isset($params['port']) || $params['port'] === '') {
index 65952a76a61323f0ef327444e78a01d118d6d2c0..2ef9614ac85c372ee159ef7a895fd5c49599b040 100644 (file)
@@ -198,7 +198,7 @@ trait S3ObjectTrait {
 
                $size = (int)($sourceMetadata->get('Size') ?? $sourceMetadata->get('ContentLength'));
 
-               if ($size > $this->copySizeLimit) {
+               if ($this->useMultipartCopy && $size > $this->copySizeLimit) {
                        $copy = new MultipartCopy($this->getConnection(), [
                                "source_bucket" => $this->getBucket(),
                                "source_key" => $from