]> source.dussan.org Git - nextcloud-server.git/commitdiff
Avoid allocating too much memory for the buffer 34552/head
authorJulius Härtl <jus@bitgrid.net>
Tue, 11 Oct 2022 13:34:27 +0000 (15:34 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Wed, 12 Oct 2022 08:35:46 +0000 (08:35 +0000)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/Files/ObjectStore/S3ObjectTrait.php

index 9d692e01a23f1a958e86af2af66fa873dfbf1f19..a88ebbeda8234e993efb015747dd679b8b0a915d 100644 (file)
@@ -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