Skip to content

Commit 02d9c7c

Browse files
lunnyjerger
authored andcommitted
Return default avatar url when user id is zero rather than updating database (go-gitea#34094)
(cherry picked from commit 88352e0)
1 parent 39341df commit 02d9c7c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/user/avatar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func GenerateRandomAvatar(ctx context.Context, u *User) error {
6262

6363
// AvatarLinkWithSize returns a link to the user's avatar with size. size <= 0 means default size
6464
func (u *User) AvatarLinkWithSize(ctx context.Context, size int) string {
65-
if u.IsGhost() {
65+
if u.IsGhost() || u.ID <= 0 {
6666
return avatars.DefaultAvatarLink()
6767
}
6868

0 commit comments

Comments
 (0)