diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2025-02-24 10:11:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-24 02:11:29 +0000 |
commit | 56a0a9c750b4cd48ca44a22ff0c860b9d035c950 (patch) | |
tree | 479279c6b6a591f46d5c454d2637ac8e004385d0 /services | |
parent | 8ae46d9684b93392885b3dd31a3185f53e046300 (diff) | |
download | gitea-56a0a9c750b4cd48ca44a22ff0c860b9d035c950.tar.gz gitea-56a0a9c750b4cd48ca44a22ff0c860b9d035c950.zip |
Fix git empty check and HEAD request (#33690)
Diffstat (limited to 'services')
-rw-r--r-- | services/context/api.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/services/context/api.go b/services/context/api.go index 230c3456d1..c163de036c 100644 --- a/services/context/api.go +++ b/services/context/api.go @@ -291,6 +291,11 @@ func RepoRefForAPI(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { ctx := GetAPIContext(req) + if ctx.Repo.Repository.IsEmpty { + ctx.APIErrorNotFound("repository is empty") + return + } + if ctx.Repo.GitRepo == nil { ctx.APIErrorInternal(fmt.Errorf("no open git repo")) return |