files < 16bytes, upload/download bug fix, see pull #45

This commit is contained in:
richard 2013-05-12 23:16:55 +01:00
parent 913e128b5d
commit 574169c8b6
2 changed files with 15 additions and 3 deletions

View file

@ -457,7 +457,13 @@ class Mega(object):
for i in range(0, len(chunk)-16, 16):
block = chunk[i:i + 16]
encryptor.encrypt(block)
i += 16
#fix for files under 16 bytes failing
if file_size > 16:
i += 16
else:
i = 0
block = chunk[i:i + 16]
if len(block) % 16:
block += '\0' * (16 - (len(block) % 16))
@ -514,7 +520,13 @@ class Mega(object):
for i in range(0, len(chunk)-16, 16):
block = chunk[i:i + 16]
encryptor.encrypt(block)
i += 16
#fix for files under 16 bytes failing
if file_size > 16:
i += 16
else:
i = 0
block = chunk[i:i + 16]
if len(block) % 16:
block += '\0' * (16 - len(block) % 16)

View file

@ -30,7 +30,7 @@ def get_package_data(package):
setup(
name='mega.py',
version='0.9.13',
version='0.9.14',
packages=get_packages('mega'),
package_data=get_package_data('mega'),
description='Python lib for the Mega.co.nz API',