check empty file hash - do not include empty files in hash list

This commit is contained in:
2023-03-03 13:48:56 +00:00
parent 3e677d9ddd
commit e7f451d4f6

View File

@@ -33,6 +33,7 @@ def get_hashes_in_dir(dir_path: str, excluded_filenames: list = []) -> list: #
filepath = os.path.join(subdir, filename)
with open(filepath, 'rb') as f:
filehash = hashlib.sha256(f.read()).hexdigest()
if filehash != 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855': # do not include hashes of empty files
hash_list.append({ 'filepath': filepath, 'filename': filename, 'sha256 hash': filehash})
return hash_list