mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-19 15:51:02 +00:00
fix 500 error for ghost avatar
This commit is contained in:
parent
fd9ad05159
commit
408b522634
1 changed files with 13 additions and 7 deletions
|
@ -6,6 +6,7 @@ package user
|
|||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
|
@ -23,7 +24,9 @@ func Avatar(ctx *context.Context) {
|
|||
|
||||
log.Debug("Asked avatar for user %v and size %v", userName, size)
|
||||
|
||||
user, err := models.GetUserByName(userName)
|
||||
user := new(models.User)
|
||||
if strings.ToLower(userName) != "ghost" {
|
||||
user, err = models.GetUserByName(userName)
|
||||
if err != nil {
|
||||
if models.IsErrUserNotExist(err) {
|
||||
ctx.ServerError("Requested avatar for invalid user", err)
|
||||
|
@ -32,6 +35,9 @@ func Avatar(ctx *context.Context) {
|
|||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
user = models.NewGhostUser()
|
||||
}
|
||||
|
||||
ctx.Redirect(user.RealSizedAvatarLink(size))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue