From 06c58ac42a235cde31ac05aeb886d04f60998c01 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Fri, 9 Apr 2021 12:15:47 -0400 Subject: [PATCH] fix unreachable config backup clear --- archivebox/config.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/archivebox/config.py b/archivebox/config.py index 2cdc3700..b12cd59e 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -499,10 +499,6 @@ def write_config_file(config: Dict[str, str], out_dir: str=None) -> ConfigDict: try: # validate the config by attempting to re-parse it CONFIG = load_all_config() - return { - key.upper(): CONFIG.get(key.upper()) - for key in config.keys() - } except BaseException: # lgtm [py/catch-base-exception] # something went horribly wrong, rever to the previous version with open(f'{config_path}.bak', 'r', encoding='utf-8') as old: @@ -512,8 +508,11 @@ def write_config_file(config: Dict[str, str], out_dir: str=None) -> ConfigDict: if Path(f'{config_path}.bak').exists(): os.remove(f'{config_path}.bak') - - return {} + + return { + key.upper(): CONFIG.get(key.upper()) + for key in config.keys() + }