mirror of
https://github.com/NovaOSS/nova-web.git
synced 2024-11-25 20:43:57 +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'):
|
if not os.path.exists('data/tos.json'):
|
||||||
open('data/tos.json', 'w', encoding='utf8').write('{}')
|
open('data/tos.json', 'w', encoding='utf8').write('{}')
|
||||||
|
|
||||||
|
try:
|
||||||
data = json.load(open('data/tos.json', encoding='utf8'))
|
data = json.load(open('data/tos.json', encoding='utf8'))
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
data = {}
|
||||||
|
|
||||||
data[code] = emoji
|
data[code] = emoji
|
||||||
json.dump(data, open('data/tos.json', 'w', encoding='utf8'))
|
json.dump(data, open('data/tos.json', 'w', encoding='utf8'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue