From 66a5bf365bff16448b0843fd2fdda72939588fa0 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 3 Aug 2025 21:33:08 +0000 Subject: [PATCH] fix ipv6 qrcode port; closes #449 --- copyparty/tcpsrv.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/copyparty/tcpsrv.py b/copyparty/tcpsrv.py index 65f343d0..b0f9391e 100644 --- a/copyparty/tcpsrv.py +++ b/copyparty/tcpsrv.py @@ -583,8 +583,7 @@ class TcpSrv(object): if not ip: return "" - if ":" in ip: - ip = "[{}]".format(ip) + hip = "[%s]" % (ip,) if ":" in ip else ip if self.args.http_only: https = "" @@ -596,7 +595,7 @@ class TcpSrv(object): ports = t1.get(ip, t2.get(ip, [])) dport = 443 if https else 80 port = "" if dport in ports or not ports else ":{}".format(ports[0]) - txt = "http{}://{}{}/{}".format(https, ip, port, self.args.qrl) + txt = "http{}://{}{}/{}".format(https, hip, port, self.args.qrl) btxt = txt.encode("utf-8") if PY2: