diff options
author | zeripath <art27@cantab.net> | 2023-02-21 00:15:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-20 19:15:49 -0500 |
commit | 35d2fa744aae5782dcced573aa08ee9ff62c8e36 (patch) | |
tree | 1f8fe3faadea3fbc8174219889e360f1b0976553 /services | |
parent | 97aacc3ea1ea89d5781da4b86a11f8340148ca49 (diff) | |
download | gitea-35d2fa744aae5782dcced573aa08ee9ff62c8e36.tar.gz gitea-35d2fa744aae5782dcced573aa08ee9ff62c8e36.zip |
Fix intermittent panic in notify issue change content (#23019)
Ensure that issue pullrequests are loaded before trying to set the
self-reference.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <leon@kske.dev>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'services')
-rw-r--r-- | services/webhook/notifier.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/services/webhook/notifier.go b/services/webhook/notifier.go index ba6d968dbd..b023717cd2 100644 --- a/services/webhook/notifier.go +++ b/services/webhook/notifier.go @@ -150,7 +150,6 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(ctx context.Context, doer *u log.Error("LoadPullRequest failed: %v", err) return } - issue.PullRequest.Issue = issue apiPullRequest := &api.PullRequestPayload{ Index: issue.Index, PullRequest: convert.ToAPIPullRequest(ctx, issue.PullRequest, nil), @@ -196,7 +195,6 @@ func (m *webhookNotifier) NotifyIssueChangeTitle(ctx context.Context, doer *user log.Error("LoadPullRequest failed: %v", err) return } - issue.PullRequest.Issue = issue err = PrepareWebhooks(ctx, EventSource{Repository: issue.Repo}, webhook_module.HookEventPullRequest, &api.PullRequestPayload{ Action: api.HookIssueEdited, Index: issue.Index, @@ -328,7 +326,10 @@ func (m *webhookNotifier) NotifyIssueChangeContent(ctx context.Context, doer *us mode, _ := access_model.AccessLevel(ctx, issue.Poster, issue.Repo) var err error if issue.IsPull { - issue.PullRequest.Issue = issue + if err := issue.LoadPullRequest(ctx); err != nil { + log.Error("LoadPullRequest: %v", err) + return + } err = PrepareWebhooks(ctx, EventSource{Repository: issue.Repo}, webhook_module.HookEventPullRequest, &api.PullRequestPayload{ Action: api.HookIssueEdited, Index: issue.Index, |