mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 08:16:43 -04:00
fix(s3): Add config option to disable multipart copy for certain s3 providers
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
58abe5e3f4
commit
238ea7a8b4
2 changed files with 4 additions and 1 deletions
|
|
@ -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'] === '') {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue