mirror of
https://github.com/usememos/memos.git
synced 2025-09-11 00:05:30 +08:00
fix: user avatar url
This commit is contained in:
parent
30f37f6a05
commit
ccfa9983e9
1 changed files with 7 additions and 1 deletions
|
@ -537,7 +537,13 @@ func convertUserFromStore(user *store.User) *v1pb.User {
|
|||
}
|
||||
// Use the avatar URL instead of raw base64 image data to reduce the response size.
|
||||
if user.AvatarURL != "" {
|
||||
userpb.AvatarUrl = fmt.Sprintf("/file/%s/avatar", userpb.Name)
|
||||
// Check if avatar url is base64 format.
|
||||
_, _, err := extractImageInfo(user.AvatarURL)
|
||||
if err == nil {
|
||||
userpb.AvatarUrl = fmt.Sprintf("/file/%s/avatar", userpb.Name)
|
||||
} else {
|
||||
userpb.AvatarUrl = user.AvatarURL
|
||||
}
|
||||
}
|
||||
return userpb
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue