From 76128e7339acc2b772236ab9409956fd1c0093c7 Mon Sep 17 00:00:00 2001 From: Stable Diffusion Daemon Date: Sat, 5 Aug 2023 22:21:05 +0900 Subject: [PATCH] only finalize when completed --- scripts/ch_lib/downloader.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/ch_lib/downloader.py b/scripts/ch_lib/downloader.py index 2b14ebc..7786929 100644 --- a/scripts/ch_lib/downloader.py +++ b/scripts/ch_lib/downloader.py @@ -108,8 +108,10 @@ def dl(url, folder, filename, filepath): print() - # rename file - os.rename(dl_file_path, file_path) - util.printD(f"File Downloaded to: {file_path}") - return file_path + if downloaded_size == total_size: + # rename file + os.rename(dl_file_path, file_path) + util.printD(f"File Downloaded to: {file_path}") + return file_path + return