From 16f29b65f2b205369043b5f4131027041692b767 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Sat, 16 Mar 2019 00:32:50 +0100 Subject: [PATCH] Use if in protocol port detection --- src/Site/SiteAnnouncer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Site/SiteAnnouncer.py b/src/Site/SiteAnnouncer.py index bd2fc2cb..df3dd76c 100644 --- a/src/Site/SiteAnnouncer.py +++ b/src/Site/SiteAnnouncer.py @@ -171,13 +171,14 @@ class SiteAnnouncer(object): if "://" not in tracker or not re.match("^[A-Za-z0-9:/\\.#-]+$", tracker): return None protocol, address = tracker.split("://", 1) - try: + if ":" in address: ip, port = address.rsplit(":", 1) - except ValueError as err: + else: ip = address - port = 80 if protocol.startswith("https"): port = 443 + else: + port = 80 back = {} back["protocol"] = protocol back["address"] = address