mirror of
https://github.com/NovaOSS/nova-web.git
synced 2024-11-25 16:43:59 +01:00
ToS check JSON decode error fix
This commit is contained in:
parent
50dd4dedb2
commit
bf1e494318
|
@ -64,7 +64,11 @@ def create_app() -> flask.Flask:
|
|||
if not os.path.exists('data/tos.json'):
|
||||
open('data/tos.json', 'w', encoding='utf8').write('{}')
|
||||
|
||||
data = json.load(open('data/tos.json', encoding='utf8'))
|
||||
try:
|
||||
data = json.load(open('data/tos.json', encoding='utf8'))
|
||||
except json.decoder.JSONDecodeError:
|
||||
data = {}
|
||||
|
||||
data[code] = emoji
|
||||
json.dump(data, open('data/tos.json', 'w', encoding='utf8'))
|
||||
|
||||
|
|
Loading…
Reference in a new issue