From ffcaf382a277bd980771d36ce915cc451ef30b25 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 26 Jul 2023 11:18:59 +0530 Subject: [PATCH] Fix visit content server in browser not working when the content server is configured to listen on an IPv6 interface. Fixes #2023737 [[Bug] When set content server to listen on IPv4 and IPv6 address, Calibre won't launch broswer when Click "Visit content server in broswer"](https://bugs.launchpad.net/calibre/+bug/2023737) --- src/calibre/gui2/actions/device.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/gui2/actions/device.py b/src/calibre/gui2/actions/device.py index 2921b1d8e2..9779e05cad 100644 --- a/src/calibre/gui2/actions/device.py +++ b/src/calibre/gui2/actions/device.py @@ -23,6 +23,8 @@ def local_url_for_content_server(): 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}'