From: Roland Häder Date: Thu, 6 Jul 2023 03:54:09 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cfc3bd77b5b6c969c8e5b5a8daebef361fab51f3;p=fba.git Continued: - cut out ' - ' only if found --- diff --git a/fba/helpers/software.py b/fba/helpers/software.py index 266a6dd..31224b4 100644 --- a/fba/helpers/software.py +++ b/fba/helpers/software.py @@ -55,7 +55,8 @@ def alias(software: str) -> str: elif "powered by" in software: logger.debug("software='%s' has 'powered by' in it", software) software = version.strip_powered_by(software) - elif isinstance(software, str) and " by " in software: + + if isinstance(software, str) and " by " in software: logger.debug("software='%s' has ' by ' in it", software) software = version.strip_until(software, " by ") elif isinstance(software, str) and " - " in software: diff --git a/fba/helpers/version.py b/fba/helpers/version.py index 19ad520..2ea6219 100644 --- a/fba/helpers/version.py +++ b/fba/helpers/version.py @@ -101,7 +101,8 @@ def strip_powered_by(software: str) -> str: software = software[start + 11:].strip() logger.debug("software='%s'", software) - software = strip_until(software, " - ") + if " - " in software: + software = strip_until(software, " - ") logger.debug("software='%s' - EXIT!", software) return software @@ -122,7 +123,8 @@ def strip_hosted_on(software: str) -> str: software = software[0:end].strip() logger.debug("software[%s]='%s'", type(software), software) - software = strip_until(software, " - ") + if " - " in software: + software = strip_until(software, " - ") logger.debug("software='%s' - EXIT!", software) return software