Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: user avatar url

johnnyjoyccfa9983e901
diff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.go
index 75d70c7fe..bb7727c4e 100644
--- a/server/router/api/v1/user_service.go
+++ b/server/router/api/v1/user_service.go
@@ -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
}