bug: fix pool parsing failing with no scheme

This commit is contained in:
Upstream Data
2024-10-29 08:57:43 -06:00
parent 43c7ac281b
commit a68fe70af4

View File

@@ -25,7 +25,10 @@ class PoolUrl:
@classmethod @classmethod
def from_str(cls, url: str) -> "PoolUrl": def from_str(cls, url: str) -> "PoolUrl":
parsed_url = urlparse(url) parsed_url = urlparse(url)
scheme = Scheme(parsed_url.scheme) if not parsed_url.scheme.strip() == "":
scheme = Scheme(parsed_url.scheme)
else:
scheme = Scheme.STRATUM_V1
host = parsed_url.hostname host = parsed_url.hostname
port = parsed_url.port port = parsed_url.port
pubkey = parsed_url.path.lstrip("/") if scheme == Scheme.STRATUM_V2 else None pubkey = parsed_url.path.lstrip("/") if scheme == Scheme.STRATUM_V2 else None