3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00

split_hostmask: raise an error on empty nick/ident/host

This commit is contained in:
James Lu 2019-09-10 19:12:26 -07:00
parent fe4bea2948
commit 899443d2fe

View File

@ -93,6 +93,8 @@ def split_hostmask(mask):
""" """
nick, identhost = mask.split('!', 1) nick, identhost = mask.split('!', 1)
ident, host = identhost.split('@', 1) ident, host = identhost.split('@', 1)
if not all({nick, ident, host}):
raise ValueError("Invalid user@host %r" % mask)
return [nick, ident, host] return [nick, ident, host]
splitHostmask = split_hostmask splitHostmask = split_hostmask