files < 16bytes, upload/download bug fix, see pull #45
This commit is contained in:
parent
913e128b5d
commit
574169c8b6
2 changed files with 15 additions and 3 deletions
16
mega/mega.py
16
mega/mega.py
|
@ -457,7 +457,13 @@ class Mega(object):
|
||||||
for i in range(0, len(chunk)-16, 16):
|
for i in range(0, len(chunk)-16, 16):
|
||||||
block = chunk[i:i + 16]
|
block = chunk[i:i + 16]
|
||||||
encryptor.encrypt(block)
|
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]
|
block = chunk[i:i + 16]
|
||||||
if len(block) % 16:
|
if len(block) % 16:
|
||||||
block += '\0' * (16 - (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):
|
for i in range(0, len(chunk)-16, 16):
|
||||||
block = chunk[i:i + 16]
|
block = chunk[i:i + 16]
|
||||||
encryptor.encrypt(block)
|
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]
|
block = chunk[i:i + 16]
|
||||||
if len(block) % 16:
|
if len(block) % 16:
|
||||||
block += '\0' * (16 - len(block) % 16)
|
block += '\0' * (16 - len(block) % 16)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -30,7 +30,7 @@ def get_package_data(package):
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='mega.py',
|
name='mega.py',
|
||||||
version='0.9.13',
|
version='0.9.14',
|
||||||
packages=get_packages('mega'),
|
packages=get_packages('mega'),
|
||||||
package_data=get_package_data('mega'),
|
package_data=get_package_data('mega'),
|
||||||
description='Python lib for the Mega.co.nz API',
|
description='Python lib for the Mega.co.nz API',
|
||||||
|
|
Loading…
Reference in a new issue