mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
connect: fix ipv6 and resolve .local only; closes #202
This commit is contained in:
parent
e2c2dd18cf
commit
b0dec83aad
|
@ -4873,24 +4873,21 @@ class HttpCli(object):
|
||||||
def tx_svcs(self) -> bool:
|
def tx_svcs(self) -> bool:
|
||||||
aname = re.sub("[^0-9a-zA-Z]+", "", self.args.vname) or "a"
|
aname = re.sub("[^0-9a-zA-Z]+", "", self.args.vname) or "a"
|
||||||
ep = self.host
|
ep = self.host
|
||||||
host = ep.split(":")[0]
|
sep = "]:" if "]" in ep else ":"
|
||||||
hport = ep[ep.find(":") :] if ":" in ep else ""
|
if sep in ep:
|
||||||
|
host, hport = ep.rsplit(":", 1)
|
||||||
import ipaddress
|
hport = ":" + hport
|
||||||
try:
|
else:
|
||||||
ipaddress.ip_address(host)
|
host = ep
|
||||||
user_used_ip = True
|
hport = ""
|
||||||
except ValueError:
|
|
||||||
user_used_ip = False
|
if host.endswith(".local") and self.args.zm and not self.args.rclone_mdns:
|
||||||
|
rip = self.conn.hsrv.nm.map(self.ip) or host
|
||||||
if user_used_ip or self.args.rclone_mdns or not self.args.zm:
|
if ":" in rip and "[" not in rip:
|
||||||
rip = (
|
rip = "[%s]" % (rip,)
|
||||||
host
|
|
||||||
if self.args.rclone_mdns or not self.args.zm
|
|
||||||
else self.conn.hsrv.nm.map(self.ip) or host
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
rip = host
|
rip = host
|
||||||
|
|
||||||
# safer than html_escape/quotep since this avoids both XSS and shell-stuff
|
# safer than html_escape/quotep since this avoids both XSS and shell-stuff
|
||||||
pw = re.sub(r"[<>&$?`\"']", "_", self.pw or "hunter2")
|
pw = re.sub(r"[<>&$?`\"']", "_", self.pw or "hunter2")
|
||||||
vp = re.sub(r"[<>&$?`\"']", "_", self.uparam["hc"] or "").lstrip("/")
|
vp = re.sub(r"[<>&$?`\"']", "_", self.uparam["hc"] or "").lstrip("/")
|
||||||
|
|
Loading…
Reference in a new issue