aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Majer <amajer@suse.com>2024-09-05 20:39:23 +0200
committerGitHub <noreply@github.com>2024-09-06 02:39:23 +0800
commitbf7ae0429cdf236510aa6702e499878bc2345a6e (patch)
tree4238f06e9ef0bbd1f140d727a3274030eb67e38c
parent19af5344623ba999f418520fad1a3bde77980561 (diff)
downloadgitea-bf7ae0429cdf236510aa6702e499878bc2345a6e.tar.gz
gitea-bf7ae0429cdf236510aa6702e499878bc2345a6e.zip
Return 404 instead of error when commit not exist (#31977)
Fix #31976
-rw-r--r--routers/api/v1/repo/commits.go2
1 files changed, 1 insertions, 1 deletions
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
}
}