This commit is contained in:
sanjayk03-dev
2024-06-07 14:35:40 +05:30
parent d4871ded1c
commit 41cd60a0f3

View File

@@ -294,7 +294,7 @@ class ConfigDownloadHandler(bbctrl.APIHandler):
self.finish() self.finish()
class ConfigRestoreHandler(bbctrl.APIHandler): class ConfigRestoreHandler(bbctrl.APIHandler):
def put(self): def put_ok(self):
if 'zipfile' not in self.request.files: if 'zipfile' not in self.request.files:
raise HTTPError(401,'No file uploaded') raise HTTPError(401,'No file uploaded')
@@ -308,9 +308,10 @@ class ConfigRestoreHandler(bbctrl.APIHandler):
fmt = socket.gethostname() + '-%Y%m%d.zip' fmt = socket.gethostname() + '-%Y%m%d.zip'
filename = datetime.date.today().strftime(fmt) filename = datetime.date.today().strftime(fmt)
file_path = os.path.join(temp_dir, filename)
try: try:
with open(temp_dir+filename,'wb') as f: with open(file_path, 'wb') as f:
f.write(zip_file['body']) f.write(zip_file['body'])
except Exception as e: except Exception as e: