mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 15:53:22 +08:00
take into account user.profile_picture can be None
This commit is contained in:
parent
264f41d466
commit
7b9136d951
1 changed files with 5 additions and 4 deletions
|
@ -54,12 +54,13 @@ def update_user_info():
|
|||
if "profile_picture" in data:
|
||||
if data["profile_picture"] is None:
|
||||
if user.profile_picture_id:
|
||||
user.profile_picture_id = None
|
||||
db.session.flush()
|
||||
|
||||
file = user.profile_picture
|
||||
if file:
|
||||
File.delete(file.id)
|
||||
s3.delete(file.path)
|
||||
|
||||
user.profile_picture_id = None
|
||||
db.session.flush()
|
||||
else:
|
||||
raw_data = base64.decodebytes(data["profile_picture"].encode())
|
||||
file_path = random_string(30)
|
||||
|
|
Loading…
Reference in a new issue