mirror of
https://github.com/9001/copyparty.git
synced 2025-12-27 13:46:42 -05: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 = {}
|
||||
else:
|
||||
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.append((uname, self.defpw[uname], hpw))
|
||||
@@ -3330,7 +3330,7 @@ class AuthSrv(object):
|
||||
return
|
||||
|
||||
jtxt = read_utf8(self.log, ap, True)
|
||||
pwdb = json.loads(jtxt)
|
||||
pwdb = json.loads(jtxt) if jtxt.strip() else {}
|
||||
|
||||
useen = set()
|
||||
urst = set()
|
||||
|
||||
Reference in New Issue
Block a user