Merging ksperling/master left MultiPartUpload.chunk_size unset prior to checking input file was stdin.
This caused a traceback uploading a multipart file.
Move setting self.chunk_size above where it's read.
... | ... |
@@ -42,6 +42,8 @@ class MultiPartUpload(object): |
42 | 42 |
if not self.upload_id: |
43 | 43 |
raise RuntimeError("Attempting to use a multipart upload that has not been initiated.") |
44 | 44 |
|
45 |
+ self.chunk_size = self.s3.config.multipart_chunk_size_mb * 1024 * 1024 |
|
46 |
+ |
|
45 | 47 |
if self.file.name != "<stdin>": |
46 | 48 |
size_left = file_size = os.stat(self.file.name)[ST_SIZE] |
47 | 49 |
nr_parts = file_size / self.chunk_size + (file_size % self.chunk_size and 1) |
... | ... |
@@ -49,8 +51,6 @@ class MultiPartUpload(object): |
49 | 49 |
else: |
50 | 50 |
debug("MultiPart: Uploading from %s" % (self.file.name)) |
51 | 51 |
|
52 |
- self.chunk_size = self.s3.config.multipart_chunk_size_mb * 1024 * 1024 |
|
53 |
- |
|
54 | 52 |
seq = 1 |
55 | 53 |
if self.file.name != "<stdin>": |
56 | 54 |
while size_left > 0: |