From 9e1721e8bc930193fd7523299e0932f7c33698fb Mon Sep 17 00:00:00 2001 From: YOKOTA Hiroshi Date: Tue, 21 Nov 2023 20:56:29 +0900 Subject: [PATCH] Don't enclose [] twice when IPv6 addr --- src/calibre/gui2/actions/device.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/calibre/gui2/actions/device.py b/src/calibre/gui2/actions/device.py index 295a5e378d..f8515e7059 100644 --- a/src/calibre/gui2/actions/device.py +++ b/src/calibre/gui2/actions/device.py @@ -27,15 +27,13 @@ def local_url_for_content_server(): if interface in addr_map: interface = addr_map[interface] - if is_ipv6_addr(interface): - interface = f'[{interface}]' - protocol = 'https' if opts.ssl_certfile and opts.ssl_keyfile else 'http' prefix = opts.url_prefix or '' + port = opts.port - if ':' in interface: - interface = f'[{interface}]' - return f'{protocol}://{interface}:{port}{prefix}' + addr = f'[{interface}]' if is_ipv6_addr(interface) else f'{interface}' + + return f'{protocol}://{addr}:{port}{prefix}' def open_in_browser():