Fixes hashing issue

This commit is contained in:
tek 2023-04-07 14:51:54 +02:00
parent 801fe367ac
commit a2cbaacfce

View File

@ -161,9 +161,12 @@ def get_sha256_from_file_path(file_path: str) -> str:
""" """
sha256_hash = hashlib.sha256() sha256_hash = hashlib.sha256()
with open(file_path, "rb") as handle: try:
for byte_block in iter(lambda: handle.read(4096), b""): with open(file_path, "rb") as handle:
sha256_hash.update(byte_block) for byte_block in iter(lambda: handle.read(4096), b""):
sha256_hash.update(byte_block)
except OSError:
return ""
return sha256_hash.hexdigest() return sha256_hash.hexdigest()