From 578d51bc54c75d1b7bc97db76d0c37ba6f46a7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Thu, 3 Oct 2019 01:45:31 +0200 Subject: [PATCH] Enclose IPv6 address in square brackets --- resources/lib/dialogs/servermanual.py | 7 +++++++ resources/lib/jellyfin/core/connection_manager.py | 1 + 2 files changed, 8 insertions(+) diff --git a/resources/lib/dialogs/servermanual.py b/resources/lib/dialogs/servermanual.py index 66d0340c..1b7c34ba 100644 --- a/resources/lib/dialogs/servermanual.py +++ b/resources/lib/dialogs/servermanual.py @@ -4,6 +4,7 @@ import logging import os +import ipaddress import xbmcgui import xbmcaddon @@ -115,6 +116,12 @@ class ServerManual(xbmcgui.WindowXMLDialog): return control def _connect_to_server(self, server, port): + try: + addr = ipaddress.ip_address(server.decode('utf-8') if not isinstance(server, type(u'')) else server) + if addr.version == 6: + server = u"[%s]" % (addr.compressed) + except ValueError: + pass server_address = "%s:%s" % (server, port) if port else server self._message("%s %s..." % (_(30610), server_address)) diff --git a/resources/lib/jellyfin/core/connection_manager.py b/resources/lib/jellyfin/core/connection_manager.py index 7496413c..f3c89f75 100644 --- a/resources/lib/jellyfin/core/connection_manager.py +++ b/resources/lib/jellyfin/core/connection_manager.py @@ -453,6 +453,7 @@ class ConnectionManager(object): else: return servers + # TODO: Make IPv6 compatable def _convert_endpoint_address_to_manual_address(self, info): if info.get('Address') and info.get('EndpointAddress'):