提交 11bc249b 编写于 作者: X Xu Han

utils.crypto: Fix the broken algorithm check in hash_file

Fix the broken algorithm check in the hash_file function, it
should return `None` if the given hash algorithm is unknown.
Signed-off-by: NXu Han <xuhan@redhat.com>
上级 7c81123d
......@@ -61,6 +61,7 @@ def hash_file(filename, size=None, algorithm="md5"):
hash_obj = hash_wrapper(algorithm=algorithm)
except ValueError:
logging.error("Unknown hash algorithm %s, returning None", algorithm)
return None
with open(filename, 'rb') as file_to_hash:
while size > 0:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册