Browse Source

Gracefully handle mtime read exception from cache

catboxanon 1 year ago
parent
commit
6ee4012c0a
1 changed files with 4 additions and 1 deletions
  1. 4 1
      modules/hashes.py

+ 4 - 1
modules/hashes.py

@@ -21,7 +21,10 @@ def calculate_sha256(filename):
 
 def sha256_from_cache(filename, title, use_addnet_hash=False):
     hashes = cache("hashes-addnet") if use_addnet_hash else cache("hashes")
-    ondisk_mtime = os.path.getmtime(filename)
+    try:
+        ondisk_mtime = os.path.getmtime(filename)
+    except FileNotFoundError:
+        return None
 
     if title not in hashes:
         return None