Skip to content

Commit 9e7a76c

Browse files
committed
use binary mode
1 parent ec8794d commit 9e7a76c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

otsserver/backup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def read_disk_cache(self, chunk):
106106

107107
try:
108108
cache_file = self.cache_path + '/' + chunk_path + '/' + chunk_str
109-
with open(cache_file, 'r') as fd:
109+
with open(cache_file, 'rb') as fd:
110110
return fd.read()
111111
except FileNotFoundError as err:
112112
return None
@@ -117,7 +117,7 @@ def write_disk_cache(self, chunk, bytes):
117117
cache_path = self.cache_path + '/' + chunk_path
118118
os.makedirs(cache_path, exist_ok=True)
119119
cache_file = cache_path + '/' + chunk_str
120-
with open(cache_file, 'w') as fd:
120+
with open(cache_file, 'wb') as fd:
121121
fd.write(bytes)
122122

123123

0 commit comments

Comments
 (0)