Skip to content

Commit bf7ae04

Browse files
authored
Return 404 instead of error when commit not exist (#31977)
Fix #31976
1 parent 19af534 commit bf7ae04

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

routers/api/v1/repo/commits.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func GetAllCommits(ctx *context.APIContext) {
195195
// get commit specified by sha
196196
baseCommit, err = ctx.Repo.GitRepo.GetCommit(sha)
197197
if err != nil {
198-
ctx.Error(http.StatusInternalServerError, "GetCommit", err)
198+
ctx.NotFoundOrServerError("GetCommit", git.IsErrNotExist, err)
199199
return
200200
}
201201
}

0 commit comments

Comments
 (0)