From: Roland Häder Date: Sun, 8 Sep 2024 00:16:26 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0bff9cea070ff8620d530e86331309c6cb80d1a6;p=fba.git Continued: - check if instance[host] is at least set and a non-empty string --- diff --git a/fba/networks/misskey.py b/fba/networks/misskey.py index 5d71e58..cf8849d 100644 --- a/fba/networks/misskey.py +++ b/fba/networks/misskey.py @@ -297,6 +297,17 @@ def fetch_blocks(domain: str) -> list: for instance in rows: # Is it there? logger.debug("instance[]='%s'", type(instance)) + if not isinstance(instance, dict): + logger.warning("instance[]='%s' is not of type 'dict' - SKIPPED!", type(instance)) + continue + elif not "host" in instance: + logger.warning("instance()=%d has no element 'host' - SKIPPED!", len(instance)) + continue + elif not isinstance(instance["host"], str): + logger.warning("instance[host][]='%s' is not of type 'str' - SKIPPED!", type(instance["host"])) + continue + + logger.debug("instance[host]='%s' - BEFORE!", instance["host"]) blocked = tidyup.domain(instance["host"]) if instance["host"] != "" else None logger.debug("blocked='%s' - AFTER!", blocked)