Merge pull request #305 from barrabinfc/master

- Handle Exception for invalid dbschema.json files (siteSign)
This commit is contained in:
ZeroNet 2016-03-04 19:51:58 +01:00
commit 6cbb6adcfc
2 changed files with 6 additions and 2 deletions

View file

@ -34,8 +34,12 @@ class SiteStorage:
# Load db from dbschema.json
def openDb(self, check=True):
schema = self.loadJson("dbschema.json")
db_path = self.getPath(schema["db_file"])
try:
schema = self.loadJson("dbschema.json")
db_path = self.getPath(schema["db_file"])
except Exception, err:
raise Exception("dbschema.json is not a valid JSON: %s" % err)
if check:
if not os.path.isfile(db_path) or os.path.getsize(db_path) == 0: # Not exist or null
self.rebuildDb()

0
zeronet.py Normal file → Executable file
View file