Stick to the offset and limit CdnFileHashes dictates (#222)

The old intersection method and allowing an arbitrary part size
wasn't working properly. Assuming that Telegram will send a sha
sum for the whole file, in the correct order, we can simply use
their offsets to download the file.
This commit is contained in:
Lonami Exo
2017-09-05 16:43:53 +02:00
parent 2924912931
commit 49555ad018
2 changed files with 31 additions and 46 deletions

View File

@@ -475,7 +475,7 @@ class TelegramBareClient:
try:
if cdn_decrypter:
result = cdn_decrypter.get_file(offset, part_size)
result = cdn_decrypter.get_file()
else:
result = client(GetFileRequest(
input_location, offset, part_size
@@ -484,8 +484,7 @@ class TelegramBareClient:
if isinstance(result, FileCdnRedirect):
cdn_decrypter, result = \
CdnDecrypter.prepare_decrypter(
client, TelegramBareClient, result,
offset, part_size
client, TelegramBareClient, result
)
except FileMigrateError as e: