diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-12-29 14:57:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-29 14:57:12 +0100 |
commit | de2b86a7a4c4fb244e9a73f805908f15f47a8626 (patch) | |
tree | 6ef6e093ea7eb6ff2a8271ae3c2deebea5792005 /lib | |
parent | 867e7c533a057fab58ef32ab5e6509820f2ad0bd (diff) | |
parent | 2aac757805587f7b5438c094b9a9d4cda7222931 (diff) | |
download | nextcloud-server-de2b86a7a4c4fb244e9a73f805908f15f47a8626.tar.gz nextcloud-server-de2b86a7a4c4fb244e9a73f805908f15f47a8626.zip |
Merge pull request #28542 from nextcloud/enh/s3-put-limit
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/ObjectStore/S3ConnectionTrait.php | 4 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/S3ObjectTrait.php | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index 9dee98ba736..b72b0ebee53 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -62,6 +62,9 @@ trait S3ConnectionTrait { /** @var int */ protected $uploadPartSize; + /** @var int */ + private $putSizeLimit; + protected $test; protected function parseParams($params) { @@ -76,6 +79,7 @@ trait S3ConnectionTrait { $this->proxy = $params['proxy'] ?? false; $this->timeout = $params['timeout'] ?? 15; $this->uploadPartSize = $params['uploadPartSize'] ?? 524288000; + $this->putSizeLimit = $params['putSizeLimit'] ?? 104857600; $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 01da7a88dc8..769901acc79 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -144,9 +144,9 @@ trait S3ObjectTrait { // ($psrStream->isSeekable() && $psrStream->getSize() !== null) evaluates to true for a On-Seekable stream // so the optimisation does not apply $buffer = new Psr7\Stream(fopen("php://memory", 'rwb+')); - Utils::copyToStream($psrStream, $buffer, MultipartUploader::PART_MIN_SIZE); + Utils::copyToStream($psrStream, $buffer, $this->uploadPartSize); $buffer->seek(0); - if ($buffer->getSize() < MultipartUploader::PART_MIN_SIZE) { + if ($buffer->getSize() < $this->putSizeLimit) { // buffer is fully seekable, so use it directly for the small upload $this->writeSingle($urn, $buffer, $mimetype); } else { |