[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Fix open call during hash verification.



commit 1da1a1787406e9e2218e0bd0248ff9fabf1228de
Author: Kevin <smeatsan@xxxxxxxxx>
Date:   Tue Aug 4 12:10:52 2020 +0200

    Fix open call during hash verification.
    
    "open" needs one of create/read/write/append
    
    https://github.com/torproject/stem/pull/72
---
 stem/descriptor/collector.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stem/descriptor/collector.py b/stem/descriptor/collector.py
index 865fc1eb..8c05a832 100644
--- a/stem/descriptor/collector.py
+++ b/stem/descriptor/collector.py
@@ -325,7 +325,7 @@ class File(object):
     # check if this file already exists with the correct checksum
 
     if os.path.exists(path):
-      with open(path, 'b') as prior_file:
+      with open(path, 'rb') as prior_file:
         expected_hash = binascii.hexlify(base64.b64decode(self.sha256)).decode('utf-8')
         actual_hash = hashlib.sha256(prior_file.read()).hexdigest()
 

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits