From 7d098c993804f428adf41b71c71df6506cdf39d2 Mon Sep 17 00:00:00 2001 From: Omachonu Ogali Date: Wed, 10 Apr 2024 19:31:49 -0400 Subject: [PATCH] Open file in binary mode when computing hash --- salt/spm/pkgfiles/local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/spm/pkgfiles/local.py b/salt/spm/pkgfiles/local.py index 2b826a5d3933..0c3b312b59e0 100644 --- a/salt/spm/pkgfiles/local.py +++ b/salt/spm/pkgfiles/local.py @@ -184,7 +184,7 @@ def hash_file(path, hashobj, conn=None): if os.path.isdir(path): return "" - with salt.utils.files.fopen(path, "r") as f: + with salt.utils.files.fopen(path, "rb") as f: hashobj.update(salt.utils.stringutils.to_bytes(f.read())) return hashobj.hexdigest()