From: Julius Härtl Date: Tue, 11 Oct 2022 13:34:27 +0000 (+0200) Subject: Avoid allocating too much memory for the buffer X-Git-Tag: v24.0.7rc1~42^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=19ed7a5bf60dc23929416ed5df7e1bcaf27cc8cd;p=nextcloud-server.git Avoid allocating too much memory for the buffer Signed-off-by: Julius Härtl --- diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index 9d692e01a23..a88ebbeda82 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -152,7 +152,7 @@ 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, $this->uploadPartSize); + Utils::copyToStream($psrStream, $buffer, $this->putSizeLimit); $buffer->seek(0); if ($buffer->getSize() < $this->putSizeLimit) { // buffer is fully seekable, so use it directly for the small upload