Skip to content

Commit 0983b27

Browse files
committed
Create at most just 1 substring when splitting
1 parent 3cc4fd6 commit 0983b27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/webhook/discord.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func (d discordConvertor) Push(p *api.PushPayload) (DiscordPayload, error) {
156156
// for each commit, generate attachment text
157157
for i, commit := range p.Commits {
158158
// limit the commit message display to just the summary, otherwise it would be hard to read
159-
message := strings.TrimRight(strings.Split(commit.Message, "\n")[0], "\r")
159+
message := strings.TrimRight(strings.SplitN(commit.Message, "\n", 1)[0], "\r")
160160

161161
// a limit of 50 is set because GitHub does the same
162162
if utf8.RuneCountInString(message) > 50 {

0 commit comments

Comments
 (0)