Fix panic when adding long comment (#12892) (#12894)

Previous PR #12881 causes out of bounds panic by working on wrong string.
This commit is contained in:
mrsdizzie 2020-09-18 16:45:00 -04:00 committed by GitHub
parent a98bf03204
commit 23aae3274a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,7 +102,7 @@ func (a *actionNotifier) NotifyCreateIssueComment(doer *models.User, repo *model
content := "" content := ""
if len(comment.Content) > 200 { if len(comment.Content) > 200 {
content = content[:strings.LastIndex(comment.Content[0:200], " ")] + "…" content = comment.Content[:strings.LastIndex(comment.Content[0:200], " ")] + "…"
} else { } else {
content = comment.Content content = comment.Content
} }