From: Roland Häder Date: Wed, 23 Aug 2023 07:47:13 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4d4dac367bd3d068f318f862a2560a0f02b4260a;p=fba.git Continued: - strip spaces off --- diff --git a/fba/helpers/software.py b/fba/helpers/software.py index 8c77934..4d83b43 100644 --- a/fba/helpers/software.py +++ b/fba/helpers/software.py @@ -108,7 +108,7 @@ def alias(software: str) -> str: software = None else: logger.debug("software='%s' is being cleaned up further ...") - software = software.rstrip("!") + software = software.rstrip("!").strip() logger.debug("software[%s]='%s' - EXIT!", type(software), software) return software @@ -130,7 +130,8 @@ def strip_hosted_on(software: str) -> str: logger.debug("software[%s]='%s'", type(software), software) if " - " in software: - software = strip_until(software, " - ") + logger.debug("Stripping ' - ' of from software='%s' ...", software) + software = strip_until(software, " - ").strip() logger.debug("software='%s' - EXIT!", software) return software @@ -152,7 +153,8 @@ def strip_powered_by(software: str) -> str: logger.debug("software='%s'", software) if " - " in software: - software = strip_until(software, " - ") + logger.debug("Stripping ' - ' of from software='%s' ...", software) + software = strip_until(software, " - ").strip() logger.debug("software='%s' - EXIT!", software) return software @@ -172,7 +174,7 @@ def strip_until(software: str, until: str) -> str: return software # Next, strip until part - end = software.find(until) + end = software.strip().find(until) logger.debug("end[%s]=%d", type(end), end) if end > 0: diff --git a/fba/http/federation.py b/fba/http/federation.py index aa1adf9..e726ae5 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -438,6 +438,8 @@ def determine_software(domain: str, path: str = None) -> str: logger.debug("software='%s' has 'powered by' in it", software) software = version.remove(software_helper.strip_powered_by(software)) + software = software.strip() + logger.debug("software='%s' - EXIT!", software) return software