Don't enclose [] twice when IPv6 addr

This commit is contained in:
YOKOTA Hiroshi 2023-11-21 20:56:29 +09:00
parent 2f751d3dab
commit 9e1721e8bc

View File

@ -27,15 +27,13 @@ def local_url_for_content_server():
if interface in addr_map: if interface in addr_map:
interface = addr_map[interface] interface = addr_map[interface]
if is_ipv6_addr(interface):
interface = f'[{interface}]'
protocol = 'https' if opts.ssl_certfile and opts.ssl_keyfile else 'http' protocol = 'https' if opts.ssl_certfile and opts.ssl_keyfile else 'http'
prefix = opts.url_prefix or '' prefix = opts.url_prefix or ''
port = opts.port port = opts.port
if ':' in interface: addr = f'[{interface}]' if is_ipv6_addr(interface) else f'{interface}'
interface = f'[{interface}]'
return f'{protocol}://{interface}:{port}{prefix}' return f'{protocol}://{addr}:{port}{prefix}'
def open_in_browser(): def open_in_browser():