From 72d17464898c8ce589898b8631dd6f8ba0eaa7c8 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Fri, 7 Jun 2024 03:57:37 +0530 Subject: [PATCH] adding config.json to the zip file --- src/py/bbctrl/Web.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/py/bbctrl/Web.py b/src/py/bbctrl/Web.py index f40c369..f2a557a 100644 --- a/src/py/bbctrl/Web.py +++ b/src/py/bbctrl/Web.py @@ -625,6 +625,17 @@ class MacrosDownloadHandler(bbctrl.APIHandler): filename = os.path.basename(url_unescape(filename)) filepath = self.get_upload(filename) zip_file.write(filepath, filename) + + config_path = self.ctrl.get_path('config.json') + try: + if os.path.exists(config_path): + zip_file.write(config_path,'config.json') + else: + json_bytes = json.dumps({'version': self.version}).encode("utf-8") + zip_file.writestr("config.json",json_bytes) + + except Exception: self.log.exception('Internal error: Failed to upgrade config') + zip_file.close() buffer.seek(0)