mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-13 00:33:44 +08:00
Backport #20981 When on /admin/users/ endpoints if the user is no longer in the DB, redirect instead of causing a http 500. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
parent
0db6add5c0
commit
ea416d7d0e
|
@ -209,7 +209,11 @@ func NewUserPost(ctx *context.Context) {
|
|||
func prepareUserInfo(ctx *context.Context) *user_model.User {
|
||||
u, err := user_model.GetUserByID(ctx.ParamsInt64(":userid"))
|
||||
if err != nil {
|
||||
if user_model.IsErrUserNotExist(err) {
|
||||
ctx.Redirect(setting.AppSubURL + "/admin/users")
|
||||
} else {
|
||||
ctx.ServerError("GetUserByID", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
ctx.Data["User"] = u
|
||||
|
|
Loading…
Reference in New Issue
Block a user