From 09abdb8a65ee1e935a63add6d7f6398d36be7ebe Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 12 Oct 2020 22:15:44 +0100 Subject: [PATCH] Return 404 not 500 from API if team does not exist (#13118) (#13119) Backport #13118 If team does not exist expect ErrTeamNotExist not ErrUserNotEXist Fix #11336 Signed-off-by: Andrew Thornton --- 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 0d62b751cc..5581f1ff2e 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -397,7 +397,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)