diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/setting.go | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 8f6ef1787b..05881a67ef 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -586,7 +586,26 @@ func getOrgRepoCtx(ctx *middleware.Context) (*OrgRepoCtx, error) { } func TriggerHook(ctx *middleware.Context) { - models.HookQueue.AddRepoID(ctx.Repo.Repository.Id) + u, err := models.GetUserByName(ctx.Params(":username")) + if err != nil { + if models.IsErrUserNotExist(err) { + ctx.Handle(404, "GetUserByName", err) + } else { + ctx.Handle(500, "GetUserByName", err) + } + return + } + + repo, err := models.GetRepositoryByName(u.Id, ctx.Params(":reponame")) + if err != nil { + if models.IsErrRepoNotExist(err) { + ctx.Handle(404, "GetRepositoryByName", err) + } else { + ctx.Handle(500, "GetRepositoryByName", err) + } + return + } + models.HookQueue.AddRepoID(repo.Id) } func GitHooks(ctx *middleware.Context) { |