From 0983b27d0dac9cbb179184eaf5e584b6ae7cd684 Mon Sep 17 00:00:00 2001 From: Kemal Zebari Date: Tue, 17 Sep 2024 16:02:12 -0700 Subject: [PATCH] Create at most just 1 substring when splitting --- services/webhook/discord.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/webhook/discord.go b/services/webhook/discord.go index ab7faaf870..59e87a7e1f 100644 --- a/services/webhook/discord.go +++ b/services/webhook/discord.go @@ -156,7 +156,7 @@ func (d discordConvertor) Push(p *api.PushPayload) (DiscordPayload, error) { // for each commit, generate attachment text for i, commit := range p.Commits { // limit the commit message display to just the summary, otherwise it would be hard to read - message := strings.TrimRight(strings.Split(commit.Message, "\n")[0], "\r") + message := strings.TrimRight(strings.SplitN(commit.Message, "\n", 1)[0], "\r") // a limit of 50 is set because GitHub does the same if utf8.RuneCountInString(message) > 50 {