From 3d8bc8ebe16488d9093279c85a279f864396f03c Mon Sep 17 00:00:00 2001 From: littlejian <17816869670@163.com> Date: Tue, 12 Oct 2021 20:24:54 +0800 Subject: [PATCH] fix: solve the problem of getting nil context in the goroutine caused by the context being recycled --- modules/gittar/helper/git_hooks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gittar/helper/git_hooks.go b/modules/gittar/helper/git_hooks.go index 851e2bc1960..b5d75f84f4b 100644 --- a/modules/gittar/helper/git_hooks.go +++ b/modules/gittar/helper/git_hooks.go @@ -116,8 +116,8 @@ func preReceiveHook(pushEvents []*models.PayloadPushEvent, c *webcontext.Context // trigger event func PostReceiveHook(pushEvents []*models.PayloadPushEvent, c *webcontext.Context) { - pusher := c.MustGet("user").(*models.User) - repository := c.MustGet("repository").(*gitmodule.Repository) + pusher := c.User + repository := c.Repository size, err := repository.CalcRepoSize() if err == nil {