diff options
author | Julius Härtl <jus@bitgrid.net> | 2023-12-28 15:31:08 +0100 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-12-29 10:48:40 +0000 |
commit | f5fe5316657ee32caca74072b3b140577ef7c55b (patch) | |
tree | 1a21f8d54d88be417d63768c5bddb912d541d161 /lib | |
parent | ad5be4f04bc2730fd4bd6b989137cbaeb2f8338e (diff) | |
download | nextcloud-server-f5fe5316657ee32caca74072b3b140577ef7c55b.tar.gz nextcloud-server-f5fe5316657ee32caca74072b3b140577ef7c55b.zip |
fix(s3): Add config option to disable multipart copy for certain s3 providers
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/ObjectStore/S3ConnectionTrait.php | 3 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/S3ObjectTrait.php | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index 51d9f687a13..e6ed9c2ef5b 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -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'] === '') { diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index 65952a76a61..2ef9614ac85 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -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 |