From 1d322d3b375ff2e93c17e79efa619a20ec809f3d Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 28 Jan 2019 14:51:19 +0100 Subject: always use multipart uploader for s3 uploads the multipart uploader handles non seekable streams while `upload` does not Signed-off-by: Robin Appelman --- lib/private/Files/ObjectStore/S3ObjectTrait.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index a1110d87c8f..0b55c319ea8 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -23,6 +23,7 @@ namespace OC\Files\ObjectStore; +use Aws\S3\MultipartUploader; use Aws\S3\S3Client; const S3_UPLOAD_PART_SIZE = 524288000; // 500MB @@ -72,10 +73,12 @@ trait S3ObjectTrait { * @since 7.0.0 */ function writeObject($urn, $stream) { - $this->getConnection()->upload($this->bucket, $urn, $stream, 'private', [ - 'mup_threshold' => S3_UPLOAD_PART_SIZE, + $uploader = new MultipartUploader($this->getConnection(), $stream, [ + 'bucket' => $this->bucket, + 'key' => $urn, 'part_size' => S3_UPLOAD_PART_SIZE ]); + $uploader->upload(); } /** -- cgit v1.2.3