Early return if download path does not exist.
@@ -1038,7 +1038,10 @@ def _check_download_dir(link, download_dir, hashes):
If a correct file is found return its path else None
"""
download_path = os.path.join(download_dir, link.filename)
- if os.path.exists(download_path):
+
+ if not os.path.exists(download_path):
+ return None
+
# If already downloaded, does its hash match?
logger.info('File was already downloaded %s', download_path)
if hashes:
@@ -1053,4 +1056,3 @@ def _check_download_dir(link, download_dir, hashes):
os.unlink(download_path)
return None
return download_path
- return None
