1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

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 <art27@cantab.net>

Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
zeripath 2020-10-12 22:09:21 +01:00 committed by GitHub
parent 8be3e439c2
commit f2858600af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -404,7 +404,7 @@ func orgAssignment(args ...bool) macaron.Handler {
if assignTeam { if assignTeam {
ctx.Org.Team, err = models.GetTeamByID(ctx.ParamsInt64(":teamid")) ctx.Org.Team, err = models.GetTeamByID(ctx.ParamsInt64(":teamid"))
if err != nil { if err != nil {
if models.IsErrUserNotExist(err) { if models.IsErrTeamNotExist(err) {
ctx.NotFound() ctx.NotFound()
} else { } else {
ctx.Error(http.StatusInternalServerError, "GetTeamById", err) ctx.Error(http.StatusInternalServerError, "GetTeamById", err)