From 0b26e970cf5ca2c36f1c823f58eef1e60a1f149b Mon Sep 17 00:00:00 2001 From: Gian Lorenzo Meocci Date: Sun, 26 Apr 2020 10:12:42 +0200 Subject: [PATCH 1/2] Pass Content-Length even if is not S3-Amazon compliant (some S3 implementantion can use it for optimization purpose) --- S3/MultiPart.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/S3/MultiPart.py b/S3/MultiPart.py index 81554e603..ae9955b54 100644 --- a/S3/MultiPart.py +++ b/S3/MultiPart.py @@ -32,6 +32,8 @@ def __init__(self, s3, src, dst_uri, headers_baseline=None, self.parts = {} self.headers_baseline = headers_baseline or {} + self.headers_baseline['content-length'] = str(self.src_size) + if isinstance(src, S3UriS3): # Source is the uri of an object to s3-to-s3 copy with multipart. self.src_uri = src From 32cde09af1683f4d60d6d8170bbe202522ac40e1 Mon Sep 17 00:00:00 2001 From: Gian Lorenzo Meocci Date: Sun, 26 Apr 2020 11:17:35 +0200 Subject: [PATCH 2/2] better name + check --- S3/MultiPart.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/S3/MultiPart.py b/S3/MultiPart.py index ae9955b54..da3b0ea4a 100644 --- a/S3/MultiPart.py +++ b/S3/MultiPart.py @@ -18,7 +18,7 @@ class MultiPartUpload(object): """Supports MultiPartUpload and MultiPartUpload(Copy) operation""" - MIN_CHUNK_SIZE_MB = 5 # 5MB + MIN_CHUNK_SIZE_MB = 5 # 5MB MAX_CHUNK_SIZE_MB = 5 * 1024 # 5GB MAX_FILE_SIZE = 5 * 1024 * 1024 # 5TB @@ -32,7 +32,9 @@ def __init__(self, s3, src, dst_uri, headers_baseline=None, self.parts = {} self.headers_baseline = headers_baseline or {} - self.headers_baseline['content-length'] = str(self.src_size) + # if the src_size is specified, set the multipart-object-size extended attribute + if src_size != None: + self.headers_baseline['x-multipart-object-size'] = str(self.src_size) if isinstance(src, S3UriS3): # Source is the uri of an object to s3-to-s3 copy with multipart.