diff options
author | zeripath <art27@cantab.net> | 2020-12-11 17:27:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-11 18:27:00 +0100 |
commit | f2f99a7d0c7ea3c667d254062d648ec387e3ea09 (patch) | |
tree | c8e365410e7f33280714fbe38830b5fac37ac8a2 /services | |
parent | 160f606a15a38fef9c0345cb07860dbeee4bee26 (diff) | |
download | gitea-f2f99a7d0c7ea3c667d254062d648ec387e3ea09.tar.gz gitea-f2f99a7d0c7ea3c667d254062d648ec387e3ea09.zip |
Ensure that pusher is not nil preventing panic in push (#13945)
PR #13381 refactored notification actions to call NotifyCreateRef and
NotifyDeleteRef in a slightly different manner. This leads to the pusher
not being set before the call.
This PR ensures that the pusher is updated before the call.
Fix #13940
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'services')
-rw-r--r-- | services/repository/push.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/services/repository/push.go b/services/repository/push.go index 2e7f1a1521..4ac37c9703 100644 --- a/services/repository/push.go +++ b/services/repository/push.go @@ -97,6 +97,12 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error { } var commits = &repo_module.PushCommits{} if opts.IsTag() { // If is tag reference { + if pusher == nil || pusher.ID != opts.PusherID { + var err error + if pusher, err = models.GetUserByID(opts.PusherID); err != nil { + return err + } + } tagName := opts.TagName() if opts.IsDelRef() { delTags = append(delTags, tagName) |