Skip to content

Commit 931de1a

Browse files
committed
Return 404 instead of error when commit not exist
Fix #31976
1 parent 74b1c58 commit 931de1a

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)