Upload supports empty files
This commit is contained in:
parent
9263d0cc06
commit
b1ada6ad69
1 changed files with 29 additions and 25 deletions
|
@ -531,7 +531,7 @@ class Mega(object):
|
|||
mac_str = '\0' * 16
|
||||
mac_encryptor = AES.new(k_str, AES.MODE_CBC, mac_str)
|
||||
iv_str = a32_to_str([ul_key[4], ul_key[5], ul_key[4], ul_key[5]])
|
||||
|
||||
if file_size > 0:
|
||||
for chunk_start, chunk_size in get_chunks(file_size):
|
||||
chunk = input_file.read(chunk_size)
|
||||
upload_progress += len(chunk)
|
||||
|
@ -561,6 +561,10 @@ class Mega(object):
|
|||
if self.options.get('verbose') is True:
|
||||
# upload progress
|
||||
print('{0} of {1} uploaded'.format(upload_progress, file_size))
|
||||
else:
|
||||
output_file = requests.post(ul_url + "/0",
|
||||
data='', timeout=self.timeout)
|
||||
completion_file_handle = output_file.text
|
||||
|
||||
file_mac = str_to_a32(mac_str)
|
||||
|
||||
|
|
Loading…
Reference in a new issue