Browse code

Merge branch 'wiof-master'

Matt Domsch authored on 2015/12/09 00:12:46
Showing 2 changed files
... ...
@@ -92,6 +92,7 @@ class Config(object):
92 92
     mime_type = ""
93 93
     enable_multipart = True
94 94
     multipart_chunk_size_mb = 15    # MB
95
+    multipart_max_chunks = 10000    # Maximum chunks on AWS S3, could be different on other S3-compatible APIs
95 96
     # List of checks to be performed for 'sync'
96 97
     sync_checks = ['size', 'md5']   # 'weak-timestamp'
97 98
     # List of compiled REGEXPs
... ...
@@ -595,6 +595,9 @@ class S3(object):
595 595
         if self.config.enable_multipart:
596 596
             if size > self.config.multipart_chunk_size_mb * 1024 * 1024 or filename == "-":
597 597
                 multipart = True
598
+                if size > self.config.multipart_max_chunks * self.config.multipart_chunk_size_mb * 1024 * 1024:
599
+                    raise ParameterError("Chunk size %d MB results in more than %d chunks. Please increase --multipart-chunk-size-mb" % \
600
+                          (self.config.multipart_chunk_size_mb, self.config.multipart_max_chunks))
598 601
         if multipart:
599 602
             # Multipart requests are quite different... drop here
600 603
             return self.send_file_multipart(file, headers, uri, size, extra_label)