diff --git a/src/py/bbctrl/FileHandler.py b/src/py/bbctrl/FileHandler.py index aac07d2..3e4b144 100644 --- a/src/py/bbctrl/FileHandler.py +++ b/src/py/bbctrl/FileHandler.py @@ -93,7 +93,6 @@ class FileHandler(bbctrl.APIHandler): else: filename = self.get_upload(self.uploadFilename).encode('utf8') safe_remove(filename) - self.get_log('FileHandler').info('uploadFile.name ' + self.uploadFile.name) os.link(self.uploadFile.name, filename) self.uploadFile.close() diff --git a/src/py/bbctrl/Web.py b/src/py/bbctrl/Web.py index 9d10840..586c91f 100644 --- a/src/py/bbctrl/Web.py +++ b/src/py/bbctrl/Web.py @@ -326,7 +326,16 @@ class ConfigRestoreHandler(bbctrl.APIHandler): if file =="config.json": with open(file_path, 'r') as json_file: json_data = json.load(json_file) - json_data["macros_list"] = [{"file_name": item["file_name"]} for item in json_data["gcode_list"]] + + if "macros" in json_data and isinstance(json_data['macros'], list): + json_data["macros_list"] = [ + {"file_name": item["file_name"]} + for item in json_data["macros"] + if isinstance(item, dict) and "file_name" in item + ] + else: + json_data["macros_list"] = [] + keys_to_remove = ['non_macros_list','gcode_list'] for key in keys_to_remove: if key in json_data: