Skip to content

Commit

Permalink
chore: 优化头像上传功能
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Porter committed Jul 9, 2024
1 parent 869d95c commit 99547a0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ def login():
@flask_login.login_required
def profile():
user=flask_login.current_user
avatarUrl=myS3.getPreSignUrl(user.avatar_url)
if(user.avatar_url==None):
avatarUrl=None
else:
avatarUrl=myS3.getPreSignUrl(user.avatar_url)
data={
"username":user.username,
"email":user.email,
Expand Down Expand Up @@ -143,7 +146,10 @@ def updateAvatar():
import os
os.remove(f"{uuidStr}.{fileType}")
db.session.commit()
avatarUrl=myS3.getPreSignUrl(user.avatar_url)
if user.avatar_url==None:
avatarUrl=None
else:
avatarUrl=myS3.getPreSignUrl(user.avatar_url)
data={
"avatar_url":avatarUrl
}
Expand Down

0 comments on commit 99547a0

Please sign in to comment.