Fix verify invalid json

This commit is contained in:
shortcutme 2019-12-31 12:44:47 +01:00
parent 60146a083c
commit 796ee572ce
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -936,10 +936,13 @@ class ContentManager(object):
if type(file) is dict:
new_content = file
else:
if sys.version_info.major == 3 and sys.version_info.minor < 6:
new_content = json.loads(file.read().decode("utf8"))
else:
new_content = json.load(file)
try:
if sys.version_info.major == 3 and sys.version_info.minor < 6:
new_content = json.loads(file.read().decode("utf8"))
else:
new_content = json.load(file)
except Exception as err:
raise VerifyError("Invalid json file: %s" % err)
if inner_path in self.contents:
old_content = self.contents.get(inner_path, {"modified": 0})
# Checks if its newer the ours