diff options
author | Robin Appelman <robin@icewind.nl> | 2019-01-28 14:51:19 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2019-01-28 14:51:19 +0100 |
commit | 1d322d3b375ff2e93c17e79efa619a20ec809f3d (patch) | |
tree | 78f421f50061ce60b074542a4f62935f54114f57 /lib | |
parent | 2767139ca9107b0aff9cfba0e9c0674011bedece (diff) | |
download | nextcloud-server-1d322d3b375ff2e93c17e79efa619a20ec809f3d.tar.gz nextcloud-server-1d322d3b375ff2e93c17e79efa619a20ec809f3d.zip |
always use multipart uploader for s3 uploads
the multipart uploader handles non seekable streams while `upload` does not
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/ObjectStore/S3ObjectTrait.php | 7 |
1 files changed, 5 insertions, 2 deletions
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(); } /** |