fix: Add image before checking files
This commit is contained in:
parent
ed222714ce
commit
96f7f0fece
3
main.py
3
main.py
@ -204,6 +204,7 @@ def site_post():
|
||||
address = [i for i in address if i['address'] != '']
|
||||
data['address'] = address
|
||||
|
||||
data['image'] = ''
|
||||
if 'image' in request.files:
|
||||
if request.files['image'].filename != '' and request.files['image'].filename != None:
|
||||
# Make sure the file is an image
|
||||
@ -212,8 +213,6 @@ def site_post():
|
||||
|
||||
file.save(f'avatars/{i["name"]}.' + extension)
|
||||
data['image'] = f'{i["name"]}.' + extension
|
||||
else:
|
||||
data['image'] = ''
|
||||
|
||||
|
||||
with open(f'sites/{i["name"]}.json', 'w') as file:
|
||||
|
Loading…
Reference in New Issue
Block a user