From d30240b431eaeccfc31a386c6b11fe70265264c1 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 26 Aug 2025 23:12:10 +0000 Subject: [PATCH] spaces in comma-sep. opts --- copyparty/__main__.py | 2 +- copyparty/authsrv.py | 1 + copyparty/cert.py | 1 + copyparty/pwhash.py | 1 + copyparty/svchub.py | 4 ++-- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 9dab68ce..26158879 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1974,7 +1974,7 @@ def main(argv: Optional[list[str]] = None) -> None: if not HAVE_IPV6 and al.i == "::": al.i = "0.0.0.0" - al.i = al.i.split(",") + al.i = [x.strip() for x in al.i.split(",")] try: if "-" in al.p: lo, hi = [int(x) for x in al.p.split("-")] diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index 1b922c22..4309ba2c 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -1659,6 +1659,7 @@ class AuthSrv(object): # accept both , and : as separators between usernames zs1, zs2 = x.replace("=", ":").split(":", 1) grps[zs1] = zs2.replace(":", ",").split(",") + grps[zs1] = [x.strip() for x in grps[zs1]] except: t = '\n invalid value "{}" for argument --grp, must be groupname:username1,username2,...' raise Exception(t.format(x)) diff --git a/copyparty/cert.py b/copyparty/cert.py index a22d2857..49fa9ea2 100644 --- a/copyparty/cert.py +++ b/copyparty/cert.py @@ -130,6 +130,7 @@ def _gen_srv(log: "RootLogger", args, netdevs: dict[str, Netdev]): nlog: "NamedLogger" = lambda msg, c=0: log("cert-gen-srv", msg, c) names = args.crt_ns.split(",") if args.crt_ns else [] + names = [x.strip() for x in names] if not args.crt_exact: for n in names[:]: names.append("*.{}".format(n)) diff --git a/copyparty/pwhash.py b/copyparty/pwhash.py index d4455ca8..d642d3c0 100644 --- a/copyparty/pwhash.py +++ b/copyparty/pwhash.py @@ -25,6 +25,7 @@ class PWHash(object): self.args = args zsl = args.ah_alg.split(",") + zsl = [x.strip() for x in zsl] alg = zsl[0] if alg == "none": alg = "" diff --git a/copyparty/svchub.py b/copyparty/svchub.py index 199ccce9..5a5e16ec 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -325,7 +325,7 @@ class SvcHub(object): self._feature_test() - decs = {k: 1 for k in self.args.th_dec.split(",")} + decs = {k.strip(): 1 for k in self.args.th_dec.split(",")} if not HAVE_VIPS: decs.pop("vips", None) if not HAVE_PIL: @@ -1095,7 +1095,7 @@ class SvcHub(object): al.tcolor = "".join([x * 2 for x in al.tcolor]) zs = al.u2sz - zsl = zs.split(",") + zsl = [x.strip() for x in zs.split(",")] if len(zsl) not in (1, 3): t = "invalid --u2sz; must be either one number, or a comma-separated list of three numbers (min,default,max)" raise Exception(t)