mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-21 05:41:54 +02:00
fix unreachable config backup clear
This commit is contained in:
@@ -499,10 +499,6 @@ def write_config_file(config: Dict[str, str], out_dir: str=None) -> ConfigDict:
|
|||||||
try:
|
try:
|
||||||
# validate the config by attempting to re-parse it
|
# validate the config by attempting to re-parse it
|
||||||
CONFIG = load_all_config()
|
CONFIG = load_all_config()
|
||||||
return {
|
|
||||||
key.upper(): CONFIG.get(key.upper())
|
|
||||||
for key in config.keys()
|
|
||||||
}
|
|
||||||
except BaseException: # lgtm [py/catch-base-exception]
|
except BaseException: # lgtm [py/catch-base-exception]
|
||||||
# something went horribly wrong, rever to the previous version
|
# something went horribly wrong, rever to the previous version
|
||||||
with open(f'{config_path}.bak', 'r', encoding='utf-8') as old:
|
with open(f'{config_path}.bak', 'r', encoding='utf-8') as old:
|
||||||
@@ -513,7 +509,10 @@ def write_config_file(config: Dict[str, str], out_dir: str=None) -> ConfigDict:
|
|||||||
if Path(f'{config_path}.bak').exists():
|
if Path(f'{config_path}.bak').exists():
|
||||||
os.remove(f'{config_path}.bak')
|
os.remove(f'{config_path}.bak')
|
||||||
|
|
||||||
return {}
|
return {
|
||||||
|
key.upper(): CONFIG.get(key.upper())
|
||||||
|
for key in config.keys()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user