mirror of
https://github.com/9001/copyparty.git
synced 2026-01-12 15:52:39 -07:00
allow existing blank chpw.json (closes #1038);
previously, would crash on startup if chpw.json exists and is blank, because valid json was enforced now allowing a blank initial file to match the behavior of sqlite
This commit is contained in:
parent
921954037b
commit
efc6a09dd3
|
|
@ -3306,7 +3306,7 @@ class AuthSrv(object):
|
||||||
pwdb = {}
|
pwdb = {}
|
||||||
else:
|
else:
|
||||||
jtxt = read_utf8(self.log, ap, True)
|
jtxt = read_utf8(self.log, ap, True)
|
||||||
pwdb = json.loads(jtxt)
|
pwdb = json.loads(jtxt) if jtxt.strip() else {}
|
||||||
|
|
||||||
pwdb = [x for x in pwdb if x[0] != uname]
|
pwdb = [x for x in pwdb if x[0] != uname]
|
||||||
pwdb.append((uname, self.defpw[uname], hpw))
|
pwdb.append((uname, self.defpw[uname], hpw))
|
||||||
|
|
@ -3330,7 +3330,7 @@ class AuthSrv(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
jtxt = read_utf8(self.log, ap, True)
|
jtxt = read_utf8(self.log, ap, True)
|
||||||
pwdb = json.loads(jtxt)
|
pwdb = json.loads(jtxt) if jtxt.strip() else {}
|
||||||
|
|
||||||
useen = set()
|
useen = set()
|
||||||
urst = set()
|
urst = set()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue