aboutsummaryrefslogtreecommitdiff
path: root/routers/private/hook_proc_receive.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/private/hook_proc_receive.go')
-rw-r--r--routers/private/hook_proc_receive.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/routers/private/hook_proc_receive.go b/routers/private/hook_proc_receive.go
index 81dbc1fd1..0653f8b0d 100644
--- a/routers/private/hook_proc_receive.go
+++ b/routers/private/hook_proc_receive.go
@@ -8,8 +8,10 @@ package private
import (
"net/http"
+ repo_model "code.gitea.io/gitea/models/repo"
gitea_context "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
+ "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/private"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/services/agit"
@@ -23,8 +25,17 @@ func HookProcReceive(ctx *gitea_context.PrivateContext) {
return
}
- results := agit.ProcReceive(ctx, opts)
- if ctx.Written() {
+ results, err := agit.ProcReceive(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, opts)
+ if err != nil {
+ if repo_model.IsErrUserDoesNotHaveAccessToRepo(err) {
+ ctx.Error(http.StatusBadRequest, "UserDoesNotHaveAccessToRepo", err.Error())
+ } else {
+ log.Error(err.Error())
+ ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
+ "Err": err.Error(),
+ })
+ }
+
return
}