From a15e4ccb6207ef38809390414ab619704434ed03 Mon Sep 17 00:00:00 2001 From: Umputun Date: Thu, 21 Jun 2018 21:49:11 -0500 Subject: [PATCH] invert error check #79 --- app/store/comment.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/store/comment.go b/app/store/comment.go index 855e0857..e0afd575 100644 --- a/app/store/comment.go +++ b/app/store/comment.go @@ -110,7 +110,7 @@ func (c *Comment) Sanitize() { } // Shortens all the automatic links in HTML: auto link has equal "href" and "text" attributes. -func shortenAutoLinks(commentHTML string, max int) string { +func shortenAutoLinks(commentHTML string, max int) (resHTML string) { doc, err := goquery.NewDocumentFromReader(strings.NewReader(commentHTML)) if err != nil { return commentHTML @@ -136,9 +136,9 @@ func shortenAutoLinks(commentHTML string, max int) string { s.SetText(short + "...") } }) - if html, err := doc.Find("body").Html(); err == nil { - return html + resHTML, err = doc.Find("body").Html() + if err != nil { + return commentHTML } - - return commentHTML + return resHTML }