From f2858600af811c584c82b45efbf343b53821575b Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 12 Oct 2020 22:09:21 +0100 Subject: [PATCH] Return 404 not 500 from API if team does not exist (#13118) If team does not exist expect ErrTeamNotExist not ErrUserNotEXist Fix #11336 Signed-off-by: Andrew Thornton Co-authored-by: Lauris BH --- routers/api/v1/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 7b2d567e3..acd97648b 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -404,7 +404,7 @@ func orgAssignment(args ...bool) macaron.Handler { if assignTeam { ctx.Org.Team, err = models.GetTeamByID(ctx.ParamsInt64(":teamid")) if err != nil { - if models.IsErrUserNotExist(err) { + if models.IsErrTeamNotExist(err) { ctx.NotFound() } else { ctx.Error(http.StatusInternalServerError, "GetTeamById", err)