aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2024-02-17 08:56:48 +0300
committerGitHub <noreply@github.com>2024-02-17 08:56:48 +0300
commitce57a6c6db5aa19f2a3b92850ac39e8218ea4a91 (patch)
tree3b8c3a42304172eb002c06a16392c3eea138fd1b
parentd70632a7cfbae45dd16b5e7f4fb0ee6e2eb73fa7 (diff)
parent6ee4012c0a4d16fb3a6b2a9ea80a7a4b54073193 (diff)
Merge pull request #14933 from AUTOMATIC1111/fix/graceful-mtime-hash-cache-exception
Gracefully handle mtime read exception from cache
-rw-r--r--modules/hashes.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/hashes.py b/modules/hashes.py
index b7a33b42..d22e5fad 100644
--- a/modules/hashes.py
+++ b/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