[runtime_env] Continue hashing if data is none (#14906)

This commit is contained in:
valiantljk-tt 2021-04-05 09:24:09 -07:00 committed by GitHub
parent 0d1b30620b
commit 9b85b0b82b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -139,9 +139,9 @@ def _hash_modules(path: Path) -> bytes:
if not Path(from_file_name).is_dir():
with open(from_file_name, mode="rb") as f:
data = f.read(BUF_SIZE)
if not data:
break
md5.update(data)
while len(data) != 0:
md5.update(data)
data = f.read(BUF_SIZE)
hash_val = _xor_bytes(hash_val, md5.digest())
return hash_val