Fix onDownloadError callback when url is invalid

Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
lzzy12 2019-09-29 05:43:34 +05:30
parent c360bebb7b
commit c638d7703e
2 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ class DownloadHelper:
download = aria2.add_magnet(link, {'dir': DOWNLOAD_DIR + str(self.__listener.message.message_id)})
self.__is_torrent = True
else:
self.__listener.onDownloadError("No download URL or URL malformed")
self.__listener.onDownloadError("No download URL or URL malformed", None, None)
return
download_dict[self.__listener.message.message_id] = DownloadStatus(download.gid,
self.__listener.message.message_id)

View File

@ -33,11 +33,11 @@ class MirrorListener(listeners.MirrorListeners):
def onDownloadError(self, error, progress_status_list: list, index: int):
LOGGER.error(error)
if progress_status_list is not None:
fs_utils.clean_download(progress_status_list[index].path())
msg = f"@{self.message.from_user.username} your download has been cancelled due to: {error}"
sendMessage(msg, self.context, self.update)
del download_dict[self.message.message_id]
fs_utils.clean_download(progress_status_list[index].path())
def onUploadStarted(self, progress_status_list: list, index: int):
pass