Skip to content
Browse files

fix multipart uploads

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.
  • Loading branch information...
1 parent f231185 commit 9147e25c5b73ca62cd81493dd7e51ec0019604e9 @mdomsch committed Jul 17, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 S3/MultiPart.py
View
4 S3/MultiPart.py
@@ -42,15 +42,15 @@ def upload_all_parts(self):
if not self.upload_id:
raise RuntimeError("Attempting to use a multipart upload that has not been initiated.")
+ self.chunk_size = self.s3.config.multipart_chunk_size_mb * 1024 * 1024
+
if self.file.name != "<stdin>":
size_left = file_size = os.stat(self.file.name)[ST_SIZE]
nr_parts = file_size / self.chunk_size + (file_size % self.chunk_size and 1)
debug("MultiPart: Uploading %s in %d parts" % (self.file.name, nr_parts))
else:
debug("MultiPart: Uploading from %s" % (self.file.name))
- self.chunk_size = self.s3.config.multipart_chunk_size_mb * 1024 * 1024
-
seq = 1
if self.file.name != "<stdin>":
while size_left > 0:

0 comments on commit 9147e25

Please sign in to comment.
Something went wrong with that request. Please try again.