Skip to content

Commit ae3bd51

Browse files
committed
Actually allow underscores in incoming service names
This was meant to be released earlier, but I failed to merge part of my patch. Fixes: ff4a262 ("Allow underscores in incoming service names") Closes python-zeroconf#102
1 parent af33c83 commit ae3bd51

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

zeroconf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ def __init__(self, zc: 'Zeroconf', type_: str, handlers=None, listener=None,
12701270
addr: str = _MDNS_ADDR, port: int = _MDNS_PORT, delay: int = _BROWSER_TIME) -> None:
12711271
"""Creates a browser for a specific type"""
12721272
assert handlers or listener, 'You need to specify at least one handler'
1273-
if not type_.endswith(service_type_name(type_)):
1273+
if not type_.endswith(service_type_name(type_, allow_underscores=True)):
12741274
raise BadTypeInNameException
12751275
threading.Thread.__init__(
12761276
self, name='zeroconf-ServiceBrowser_' + type_)
@@ -1403,7 +1403,7 @@ def __init__(self, type_: str, name: str, address: bytes = None, port: int = Non
14031403
bytes for the text field)
14041404
server: fully qualified name for service host (defaults to name)"""
14051405

1406-
if not type_.endswith(service_type_name(name)):
1406+
if not type_.endswith(service_type_name(name, allow_underscores=True)):
14071407
raise BadTypeInNameException
14081408
self.type = type_
14091409
self.name = name

0 commit comments

Comments
 (0)