From d8ace8746811fb510c4410412986e96d30af5926 Mon Sep 17 00:00:00 2001 From: z4yx Date: Sat, 25 Apr 2020 09:33:44 +0800 Subject: [PATCH] fix exception introduced by the last commit --- apt-sync.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apt-sync.py b/apt-sync.py index 10e7e75..2195238 100755 --- a/apt-sync.py +++ b/apt-sync.py @@ -80,9 +80,8 @@ def check_and_download(url: str, dst_file: Path, caching = False)->int: return 0 except BaseException as e: print(e, flush=True) - if dst_file.is_file(): - dst_file.unlink() - del download_cache[url] + if dst_file.is_file(): dst_file.unlink() + if url in download_cache: del download_cache[url] return 1 def mkdir_with_dot_tmp(folder: Path)->Tuple[Path, Path]: