diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index b1081df9..a4442718 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -693,8 +693,10 @@ class AuthSrv(object): self.user = user self.iuser = {v: k for k, v in user.items()} + self.re_pwd = None pwds = [re.escape(x) for x in self.iuser.keys()] - self.re_pwd = re.compile("=(" + "|".join(pwds) + ")([]&; ]|$)") + if pwds: + self.re_pwd = re.compile("=(" + "|".join(pwds) + ")([]&; ]|$)") # import pprint # pprint.pprint({"usr": user, "rd": mread, "wr": mwrite, "mnt": mount}) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 5726fba8..6f04b3d0 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -55,7 +55,7 @@ class HttpCli(object): def log(self, msg, c=0): ptn = self.asrv.re_pwd - if ptn.search(msg): + if ptn and ptn.search(msg): msg = ptn.sub(self.unpwd, msg) self.log_func(self.log_src, msg, c)