mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-26 06:16:56 +09:00
fix: avoid index out-of-range panic in webhook assignee formatting (#39827)
getPullRequestInfo and getIssuesInfo indexed into the last element of an empty Assignees slice when Action was HookIssueAssigned, causing a panic under a race where the assignee list is empty by the time the webhook payload is built. Fixes https://github.com/go-gitea/gitea/issues/39826 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
1 parent
b0ae5890cf
commit
7f420f8d82
8 files changed
+347
-60
No files matched your search
@@ -393,7 +393,7 @@ type IssuePayload struct {
|
||||
Action HookIssueAction `json:"action"`
|
||||
// The index number of the issue
|
||||
Index int64 `json:"number"`
|
||||
// Changes made to the issue (for edit actions)
|
||||
// Changes made to the issue
|
||||
Changes *ChangesPayload `json:"changes,omitempty"`
|
||||
// The issue that was acted upon
|
||||
Issue *Issue `json:"issue"`
|
||||
@@ -430,6 +430,10 @@ type ChangesPayload struct {
|
||||
AddedLabels []*Label `json:"added_labels"`
|
||||
// Changes made to the labels removed
|
||||
RemovedLabels []*Label `json:"removed_labels"`
|
||||
// Assignees added
|
||||
AddedAssignees []*User `json:"added_assignees,omitempty"`
|
||||
// Assignees removed
|
||||
RemovedAssignees []*User `json:"removed_assignees,omitempty"`
|
||||
}
|
||||
|
||||
// PullRequestPayload represents a payload information of pull request event.
|
||||
@@ -442,7 +446,7 @@ type PullRequestPayload struct {
|
||||
After string `json:"after,omitempty"`
|
||||
// The index number of the pull request
|
||||
Index int64 `json:"number"`
|
||||
// Changes made to the pull request (for edit actions)
|
||||
// Changes made to the pull request
|
||||
Changes *ChangesPayload `json:"changes,omitempty"`
|
||||
// The pull request that was acted upon
|
||||
PullRequest *PullRequest `json:"pull_request"`
|
||||
|
||||
Reference in new issue
Block a user