Skip to content

Commit ec8794d

Browse files
committed
create cache path before writing
1 parent e5ffd61 commit ec8794d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

otsserver/backup.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ def read_disk_cache(self, chunk):
114114
def write_disk_cache(self, chunk, bytes):
115115
chunk_str = "{0:0>7}".format(chunk)
116116
chunk_path = chunk_str[0:3]
117-
cache_file = self.cache_path + '/' + chunk_path + '/' + chunk_str
117+
cache_path = self.cache_path + '/' + chunk_path
118+
os.makedirs(cache_path, exist_ok=True)
119+
cache_file = cache_path + '/' + chunk_str
118120
with open(cache_file, 'w') as fd:
119121
fd.write(bytes)
120122

0 commit comments

Comments
 (0)