From 7ebd051ed3939f9b40c15dca6473989d3af5c819 Mon Sep 17 00:00:00 2001 From: lzzy12 Date: Sat, 28 Sep 2019 18:24:27 +0530 Subject: [PATCH] Fix download cleanup Signed-off-by: lzzy12 --- bot/helper/download_status.py | 2 +- bot/helper/fs_utils.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bot/helper/download_status.py b/bot/helper/download_status.py index d1f4f37..f12ba3a 100644 --- a/bot/helper/download_status.py +++ b/bot/helper/download_status.py @@ -31,7 +31,7 @@ class DownloadStatus: return self.__download.name def path(self): - return "{}{}/{}".format(DOWNLOAD_DIR, self.__uid, self.name()) + return "{}{}".format(DOWNLOAD_DIR, self.__uid) def size(self): return self.__download.total_length_string() diff --git a/bot/helper/fs_utils.py b/bot/helper/fs_utils.py index 50c34dc..50d58d5 100644 --- a/bot/helper/fs_utils.py +++ b/bot/helper/fs_utils.py @@ -8,10 +8,8 @@ import mimetypes def clean_download(path: str): if os.path.exists(path): - if os.path.isfile(path): - os.remove(path) - else: - shutil.rmtree(path) + LOGGER.info("Cleaning download: {}".format(path)) + shutil.rmtree(path) def exit_clean_up(signal, frame):