1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Early return if download path does not exist.

This commit is contained in:
Chris Hunt 2019-09-18 22:32:17 -04:00
parent 892b58f244
commit e4714fbe8a

View file

@ -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