Handle invalid ports

main
Bob Mottram 2020-03-01 10:01:15 +00:00
parent 7758253215
commit 5e1e5f8961
1 changed files with 4 additions and 1 deletions

View File

@ -188,7 +188,10 @@ def getDomainFromActor(actor: str) -> (str,int):
else: else:
domain = actor.split('/users/')[0].replace('https://','').replace('http://','').replace('i2p://','').replace('dat://','') domain = actor.split('/users/')[0].replace('https://','').replace('http://','').replace('i2p://','').replace('dat://','')
if ':' in domain: if ':' in domain:
port=int(domain.split(':')[1]) portStr=domain.split(':')[1]
if not portStr.isdigit():
return None,None
port=int(portStr)
domain=domain.split(':')[0] domain=domain.split(':')[0]
return domain,port return domain,port