From b74c8d620cf3e371b889ca9d306e83a93d9180c3 Mon Sep 17 00:00:00 2001 From: Boris Pozdena Date: Thu, 12 Oct 2023 16:15:40 +0200 Subject: [PATCH] Ensure default values are removed from user OD config --- src/OneDriveGUI.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/OneDriveGUI.py b/src/OneDriveGUI.py index cc4359e..6bbce00 100644 --- a/src/OneDriveGUI.py +++ b/src/OneDriveGUI.py @@ -2983,6 +2983,13 @@ def save_global_config(): od_config = ConfigParser() od_config.read_dict(_od_config) + # Remove keys with default values from config before it is saved on disk. OneDrive client can't start when config contains default/empty key values. + for section in od_config.sections(): + if section in _default_od_config: + for option in od_config[section]: + if option in _default_od_config[section] and od_config[section][option] == _default_od_config[section][option]: + od_config.remove_option(section, option) + # Backup last config os.system(f"cp {od_config_file} {od_config_file}_backup")