Skip to content

Commit 88352e0

Browse files
authored
Return default avatar url when user id is zero rather than updating database (#34094)
1 parent e2ac789 commit 88352e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

models/user/avatar.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ func GenerateRandomAvatar(ctx context.Context, u *User) error {
6161

6262
// AvatarLinkWithSize returns a link to the user's avatar with size. size <= 0 means default size
6363
func (u *User) AvatarLinkWithSize(ctx context.Context, size int) string {
64-
if u.IsGhost() || u.IsGiteaActions() {
64+
// ghost user was deleted, Gitea actions is a bot user, 0 means the user should be a virtual user
65+
// which comes from git configure information
66+
if u.IsGhost() || u.IsGiteaActions() || u.ID <= 0 {
6567
return avatars.DefaultAvatarLink()
6668
}
6769

0 commit comments

Comments
 (0)