aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--routers/api/v1/repo/notes.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/routers/api/v1/repo/notes.go b/routers/api/v1/repo/notes.go
index 2d1f3291f..74969f2ca 100644
--- a/routers/api/v1/repo/notes.go
+++ b/routers/api/v1/repo/notes.go
@@ -58,8 +58,18 @@ func getNote(ctx *context.APIContext, identifier string) {
return
}
+ commitSHA, err := ctx.Repo.GitRepo.ConvertToSHA1(identifier)
+ if err != nil {
+ if git.IsErrNotExist(err) {
+ ctx.NotFound(err)
+ } else {
+ ctx.Error(http.StatusInternalServerError, "ConvertToSHA1", err)
+ }
+ return
+ }
+
var note git.Note
- if err := git.GetNote(ctx, ctx.Repo.GitRepo, identifier, &note); err != nil {
+ if err := git.GetNote(ctx, ctx.Repo.GitRepo, commitSHA.String(), &note); err != nil {
if git.IsErrNotExist(err) {
ctx.NotFound(identifier)
return