mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 14:42:54 +01:00
fix: block malformed records on config import
This commit is contained in:
1 parent
29aeb550b3
commit
7bf0fde3fc
2 files changed
+4
-4
No files matched your search
@@ -7,6 +7,7 @@ from pathlib import Path
|
|||||||
Convert legacy dztuirc to config.json
|
Convert legacy dztuirc to config.json
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class UnsupportedKey(Exception):
|
class UnsupportedKey(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -59,6 +60,9 @@ def rc2json(file: Path) -> str:
|
|||||||
ntok = lex.get_token().strip('""')
|
ntok = lex.get_token().strip('""')
|
||||||
if ntok == ")":
|
if ntok == ")":
|
||||||
break
|
break
|
||||||
|
# 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)
|
ips.append(ntok)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
@@ -152,10 +152,6 @@ class ServerModelManager:
|
|||||||
|
|
||||||
@call_on_thread(dialog.fetching)
|
@call_on_thread(dialog.fetching)
|
||||||
def _dump_ips(self, ips: list[str]) -> None:
|
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
|
job = Servers.query_direct
|
||||||
servers = []
|
servers = []
|
||||||
with ThreadPoolExecutor() as executor:
|
with ThreadPoolExecutor() as executor:
|
||||||
|
|||||||
Reference in new issue
Block a user