From bf7ae0429cdf236510aa6702e499878bc2345a6e Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Thu, 5 Sep 2024 20:39:23 +0200 Subject: [PATCH] Return 404 instead of error when commit not exist (#31977) Fix #31976 --- routers/api/v1/repo/commits.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/api/v1/repo/commits.go b/routers/api/v1/repo/commits.go index d33be9d80a..cec7c3d534 100644 --- a/routers/api/v1/repo/commits.go +++ b/routers/api/v1/repo/commits.go @@ -195,7 +195,7 @@ func GetAllCommits(ctx *context.APIContext) { // get commit specified by sha baseCommit, err = ctx.Repo.GitRepo.GetCommit(sha) if err != nil { - ctx.Error(http.StatusInternalServerError, "GetCommit", err) + ctx.NotFoundOrServerError("GetCommit", git.IsErrNotExist, err) return } }