Skip to content

Commit d936694

Browse files
authored
Merge pull request #34537 from nextcloud/bugfix/noid/s3-upload-memory
Avoid allocating too much memory for the buffer on s3 uploads
2 parents 2525f7e + 214a50d commit d936694

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/private/Files/ObjectStore/S3ObjectTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function writeObject($urn, $stream, string $mimetype = null) {
152152
// ($psrStream->isSeekable() && $psrStream->getSize() !== null) evaluates to true for a On-Seekable stream
153153
// so the optimisation does not apply
154154
$buffer = new Psr7\Stream(fopen("php://memory", 'rwb+'));
155-
Utils::copyToStream($psrStream, $buffer, $this->uploadPartSize);
155+
Utils::copyToStream($psrStream, $buffer, $this->putSizeLimit);
156156
$buffer->seek(0);
157157
if ($buffer->getSize() < $this->putSizeLimit) {
158158
// buffer is fully seekable, so use it directly for the small upload

0 commit comments

Comments
 (0)