Skip to content
Snippets Groups Projects
Unverified Commit eed390db authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Probably need to open the file in binary mode

parent 69c9668b
Branches
No related tags found
1 merge request!100Windows CI
......@@ -512,7 +512,7 @@ def get_storage_index_share_size(sharepath):
# share data is structured. A lot of this seems to be wrong.
# storage/immutable.py appears to have the correct information.
fmt = ">LL"
with open(sharepath) as share_file:
with open(sharepath, "rb") as share_file:
header = share_file.read(calcsize(fmt))
if len(header) != calcsize(fmt):
......@@ -570,7 +570,7 @@ def get_slot_share_size(sharepath):
:return int: The data size of the share in bytes.
"""
with open(sharepath) as share_file:
with open(sharepath, "rb") as share_file:
share_data_length_bytes = share_file.read(92)[-8:]
(share_data_length,) = unpack('>Q', share_data_length_bytes)
return share_data_length
......@@ -598,7 +598,7 @@ def get_stat(sharepath):
This is necessary to differentiate between buckets and slots.
"""
# Figure out if it is a storage index or a slot.
with open(sharepath) as share_file:
with open(sharepath, "rb") as share_file:
magic = share_file.read(32)
if magic == "Tahoe mutable container v1\n" + "\x75\x09\x44\x03\x8e":
return stat_slot
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment