Skip to content

Commit d9002ff

Browse files
catboxanonruchej
authored andcommitted
Gracefully handle mtime read exception from cache
1 parent 30a18a3 commit d9002ff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/hashes.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ def calculate_sha256(filename):
2121

2222
def sha256_from_cache(filename, title, use_addnet_hash=False):
2323
hashes = cache("hashes-addnet") if use_addnet_hash else cache("hashes")
24-
ondisk_mtime = os.path.getmtime(filename)
24+
try:
25+
ondisk_mtime = os.path.getmtime(filename)
26+
except FileNotFoundError:
27+
return None
2528

2629
if title not in hashes:
2730
return None

0 commit comments

Comments
 (0)