mirror of
https://github.com/9001/copyparty.git
synced 2026-02-22 10:23:30 +10: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:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user