From 4d6c48e91f00069670a36e056707cbad8aa34edd Mon Sep 17 00:00:00 2001 From: deajan Date: Wed, 16 Apr 2025 19:04:24 +0200 Subject: [PATCH] GUI: Fix #156 when setting empty strings --- npbackup/gui/config.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/npbackup/gui/config.py b/npbackup/gui/config.py index 3c8efd8..d2b72a2 100644 --- a/npbackup/gui/config.py +++ b/npbackup/gui/config.py @@ -838,15 +838,21 @@ def config_gui(full_config: dict, config_file: str): "repo_opts.upload_speed", "repo_opts.download_speed", ): - if ( - full_config.g(inheritance_key) is not None - and value is not None - and ( - BytesConverter(full_config.g(inheritance_key)).bytes - == BytesConverter(value).bytes + try: + if ( + full_config.g(inheritance_key) not in (None, "") + and value not in (None, "") + and ( + BytesConverter(full_config.g(inheritance_key)).bytes + == BytesConverter(value).bytes + ) + ): + continue + except ValueError as exc: + logger.debug( + f"BytesConverter could not convert value: {exc}" ) - ): - continue + pass # Don't bother to update empty strings, empty lists and None # unless we have False, or 0, which or course need to be updated