Commit ccfa9983 authored by johnnyjoy's avatar johnnyjoy

fix: user avatar url

parent 30f37f6a
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment