Pārlūkot izejas kodu

Fix SHA crash

tags/v0.3.1
Russ Garrett 5 gadus atpakaļ
vecāks
revīzija
310f8f9135
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4
    1
      httplistener/templates.go

+ 4
- 1
httplistener/templates.go Parādīt failu

@@ -36,6 +36,9 @@ func refType(ref string) string {
36 36
 }
37 37
 
38 38
 func truncateSha(sha string) string {
39
+	if len(sha) < 8 {
40
+		return ""
41
+	}
39 42
 	return sha[len(sha)-7:]
40 43
 }
41 44
 
@@ -99,7 +102,7 @@ func commitLimit(pl github.PushPayload, length int) []Commit {
99 102
 		if !c.Distinct {
100 103
 			continue
101 104
 		}
102
-		res = append(res, Commit{Message: c.Message, Username: c.Author.Username, Sha: c.Sha})
105
+		res = append(res, Commit{Message: c.Message, Username: c.Author.Username, Sha: c.ID})
103 106
 		i += 1
104 107
 		if i == length {
105 108
 			break

Notiek ielāde…
Atcelt
Saglabāt