mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-28 04:36:11 +01:00
- Backport #21476 - Instead of returning a 500 Internal Server when the user wasn't found, return 404 Not found.
This commit is contained in:
parent
f48fda8eef
commit
3f032759ed
|
@ -31,6 +31,10 @@ func AvatarByUserName(ctx *context.Context) {
|
||||||
if strings.ToLower(userName) != "ghost" {
|
if strings.ToLower(userName) != "ghost" {
|
||||||
var err error
|
var err error
|
||||||
if user, err = user_model.GetUserByName(ctx, userName); err != nil {
|
if user, err = user_model.GetUserByName(ctx, userName); err != nil {
|
||||||
|
if user_model.IsErrUserNotExist(err) {
|
||||||
|
ctx.NotFound("GetUserByName", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
ctx.ServerError("Invalid user: "+userName, err)
|
ctx.ServerError("Invalid user: "+userName, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue