Goit

Simple and lightweight Git web server
git clone http://git.omkov.net/Goit
Log | Tree | Refs | README | Download

AuthorJakob Wakeling <[email protected]>
Date2023-12-24 09:42:16
Commitd0367aad8e31d8c388f418ef898228986d84d2d8
Parent70fd6ec3e76cb05bd54c9f923ed115f95cfc3cdc

Fix index out of bounds on certain commit messages

Diffstat

M src/repo/commit.go | 4 +---

1 files changed, 1 insertions, 3 deletions

diff --git a/src/repo/commit.go b/src/repo/commit.go
index 919d8f9..6b353aa 100644
--- a/src/repo/commit.go
+++ b/src/repo/commit.go
@@ -97,9 +97,7 @@ func HandleCommit(w http.ResponseWriter, r *http.Request) {
 		data.Parents = append(data.Parents, h.String())
 	}
 
-	message := strings.SplitN(commit.Message, "\n", 2)
-	data.MessageSubject = message[0]
-	data.MessageBody = message[1]
+	data.MessageSubject, data.MessageBody, _ = strings.Cut(commit.Message, "\n")
 
 	st, err := goit.DiffStats(commit)
 	if err != nil {