From 5ed4c7100c5f569059a977a3a0d262820590639c Mon Sep 17 00:00:00 2001 From: Umputun Date: Fri, 26 Mar 2021 14:59:08 -0500 Subject: [PATCH] shorter match condition --- backend/app/store/comment.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/app/store/comment.go b/backend/app/store/comment.go index f9ee42a0..b0787784 100644 --- a/backend/app/store/comment.go +++ b/backend/app/store/comment.go @@ -158,8 +158,7 @@ var reHref = regexp.MustCompile(`]*?\s+)?href="([^"]*)"`) func (c *Comment) sanitizeAsURL(inp string) string { h := fmt.Sprintf(``, inp) clean := bluemonday.UGCPolicy().Sanitize(h) - match := reHref.FindStringSubmatch(clean) - if len(match) > 1 { + if match := reHref.FindStringSubmatch(clean); len(match) > 1 { return match[1] } return "" // this shouldn't happen as we build the href