aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorJack Hay <jack@allspice.io>2023-08-12 03:33:12 -0400
committerGitHub <noreply@github.com>2023-08-12 07:33:12 +0000
commitc5888eb9854f5a04d5e796f2a53c64c9fc4c0cba (patch)
tree5d1ad281f4bf7cfcd58b951a769961e8c24d4c9f /modules
parent9fc68b680feb49071c6c348be7701f1c79f5181d (diff)
downloadgitea-c5888eb9854f5a04d5e796f2a53c64c9fc4c0cba.tar.gz
gitea-c5888eb9854f5a04d5e796f2a53c64c9fc4c0cba.zip
Set commit id when ref used explicitly (#26447)
In the `RepoRefForAPI()` context function `CommitID` is not set if `ref` is used. It is set correctly for other if/else branches where `Commit` is set. It doesn't appear that any routes that use `RepoRefForAPI()` also use `CommitID` but that may be the case in the future. ## Changes - Sets `ctx.Repo.CommitID` when `ref` is explicitly used for api routes that use `RepoRefForAPI()`
Diffstat (limited to 'modules')
-rw-r--r--modules/context/api.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/context/api.go b/modules/context/api.go
index a367597e8a..58532b883d 100644
--- a/modules/context/api.go
+++ b/modules/context/api.go
@@ -340,6 +340,7 @@ func RepoRefForAPI(next http.Handler) http.Handler {
return
}
ctx.Repo.Commit = commit
+ ctx.Repo.CommitID = ctx.Repo.Commit.ID.String()
ctx.Repo.TreePath = ctx.Params("*")
next.ServeHTTP(w, req)
return