summaryrefslogtreecommitdiffstats
path: root/services/webhook/msteams.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-11-17 12:17:33 +0100
committerGitHub <noreply@github.com>2023-11-17 12:17:33 +0100
commit58f5fa653676fefc9b497e2cc18af976f749273c (patch)
tree059454a78551216b9f3e160a63e2b3acd1005de6 /services/webhook/msteams.go
parent17d246cdcc0bf615ee4ba97a17c0f7e2c2f5f27f (diff)
downloadgitea-58f5fa653676fefc9b497e2cc18af976f749273c.tar.gz
gitea-58f5fa653676fefc9b497e2cc18af976f749273c.zip
Fix Matrix and MSTeams nil dereference (#28089)
Fixes #28088 Fixes #28094 Added missing tests. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'services/webhook/msteams.go')
-rw-r--r--services/webhook/msteams.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/webhook/msteams.go b/services/webhook/msteams.go
index f58da3fe1c..37810b4cd3 100644
--- a/services/webhook/msteams.go
+++ b/services/webhook/msteams.go
@@ -316,11 +316,12 @@ func GetMSTeamsPayload(p api.Payloader, event webhook_module.HookEventType, _ st
}
func createMSTeamsPayload(r *api.Repository, s *api.User, title, text, actionTarget string, color int, fact *MSTeamsFact) *MSTeamsPayload {
- facts := []MSTeamsFact{
- {
+ facts := make([]MSTeamsFact, 0, 2)
+ if r != nil {
+ facts = append(facts, MSTeamsFact{
Name: "Repository:",
Value: r.FullName,
- },
+ })
}
if fact != nil {
facts = append(facts, *fact)