]> source.dussan.org Git - gitea.git/commitdiff
Fix panic when adding long comment (#12892)
authormrsdizzie <info@mrsdizzie.com>
Fri, 18 Sep 2020 17:50:06 +0000 (13:50 -0400)
committerGitHub <noreply@github.com>
Fri, 18 Sep 2020 17:50:06 +0000 (13:50 -0400)
Previous PR #12881 causes out of bounds panic by working on wrong string.

modules/notification/action/action.go

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