mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 12:59:46 +00:00
Fix iter_download would not determine file_size alone
This commit is contained in:
@@ -551,6 +551,15 @@ class DownloadMethods:
|
|||||||
await stream.close()
|
await stream.close()
|
||||||
assert len(header) == 32
|
assert len(header) == 32
|
||||||
"""
|
"""
|
||||||
|
info = utils._get_file_info(file)
|
||||||
|
if info.dc_id is not None:
|
||||||
|
dc_id = info.dc_id
|
||||||
|
|
||||||
|
if file_size is None:
|
||||||
|
file_size = info.size
|
||||||
|
|
||||||
|
file = info.location
|
||||||
|
|
||||||
if chunk_size is None:
|
if chunk_size is None:
|
||||||
chunk_size = request_size
|
chunk_size = request_size
|
||||||
|
|
||||||
@@ -568,11 +577,6 @@ class DownloadMethods:
|
|||||||
elif request_size > MAX_CHUNK_SIZE:
|
elif request_size > MAX_CHUNK_SIZE:
|
||||||
request_size = MAX_CHUNK_SIZE
|
request_size = MAX_CHUNK_SIZE
|
||||||
|
|
||||||
old_dc = dc_id
|
|
||||||
dc_id, file = utils.get_input_location(file)
|
|
||||||
if dc_id is None:
|
|
||||||
dc_id = old_dc
|
|
||||||
|
|
||||||
if chunk_size == request_size \
|
if chunk_size == request_size \
|
||||||
and offset % MIN_CHUNK_SIZE == 0 \
|
and offset % MIN_CHUNK_SIZE == 0 \
|
||||||
and stride % MIN_CHUNK_SIZE == 0:
|
and stride % MIN_CHUNK_SIZE == 0:
|
||||||
|
Reference in New Issue
Block a user