From 7bf0fde3fcefa8d5f9586216df2c144cd2df9b7e Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Fri, 1 May 2026 21:56:22 +0900 Subject: [PATCH] fix: block malformed records on config import --- dzgui/config/convert.py | 6 +++++- dzgui/model/servers.py | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dzgui/config/convert.py b/dzgui/config/convert.py index c4c886e..bd8c176 100644 --- a/dzgui/config/convert.py +++ b/dzgui/config/convert.py @@ -7,6 +7,7 @@ from pathlib import Path Convert legacy dztuirc to config.json """ + class UnsupportedKey(Exception): pass @@ -59,7 +60,10 @@ def rc2json(file: Path) -> str: ntok = lex.get_token().strip('""') if ntok == ")": break - ips.append(ntok) + # TODO: make test for this + # NOTE: strip malformed records from ancient config file versions + if len(ntok.split(":")) == 3 and ntok.split(":")[2] != "": + ips.append(ntok) continue if not tok: diff --git a/dzgui/model/servers.py b/dzgui/model/servers.py index f008c24..2df1068 100644 --- a/dzgui/model/servers.py +++ b/dzgui/model/servers.py @@ -152,10 +152,6 @@ class ServerModelManager: @call_on_thread(dialog.fetching) def _dump_ips(self, ips: list[str]) -> None: - # NOTE: block malformed records (TODO: add github issue no.) - # TODO: sanitize ip list at config time and drop this - # TODO: make test for this - ips = [ip for ip in ips if len(ip.split(":")) == 3 and ip.split(":")[2] != ""] job = Servers.query_direct servers = [] with ThreadPoolExecutor() as executor: