Skip to content

Commit

Permalink
Ensure that pusher is not nil preventing panic in push (go-gitea#13945)
Browse files Browse the repository at this point in the history
PR go-gitea#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 go-gitea#13940

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath authored Dec 11, 2020
1 parent 160f606 commit f2f99a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions services/repository/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f2f99a7

Please sign in to comment.