Avoid triggering FileMigrateError when possible

This commit is contained in:
Lonami Exo
2018-07-21 11:59:44 +02:00
parent 5a9a00e7ae
commit a9cc35e604
3 changed files with 22 additions and 10 deletions

View File

@@ -200,10 +200,13 @@ class DownloadMethods(UserMethods):
else:
f = file
# The used sender will change if ``FileMigrateError`` occurs
sender = self._sender
exported = False
input_location = utils.get_input_location(input_location)
dc_id, input_location = utils.get_input_location(input_location)
exported = dc_id and self.session.dc_id != dc_id
if exported:
sender = await self._borrow_exported_sender(dc_id)
else:
# The used sender will also change if ``FileMigrateError`` occurs
sender = self._sender
__log__.info('Downloading file in chunks of %d bytes', part_size)
try: