diff --git a/app/store/comment.go b/app/store/comment.go
index 6bfc603a..855e0857 100644
--- a/app/store/comment.go
+++ b/app/store/comment.go
@@ -65,7 +65,7 @@ const (
)
// Maximum length for URL text shortening.
-const shortURLLen = 32
+const shortURLLen = 48
// PrepareUntrusted pre-processes a comment received from untrusted source by clearing all
// autogen fields and reset everything users not supposed to provide
@@ -101,7 +101,8 @@ func (c *Comment) SetDeleted(mode DeleteMode) {
func (c *Comment) Sanitize() {
p := bluemonday.UGCPolicy()
p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA-Z0-9]+$")).OnElements("code")
- c.Text = shortenAutoLinks(p.Sanitize(c.Text), shortURLLen)
+ c.Text = p.Sanitize(c.Text)
+ c.Text = shortenAutoLinks(c.Text, shortURLLen)
c.Orig = p.Sanitize(c.Orig)
c.User.ID = template.HTMLEscapeString(c.User.ID)
c.User.Name = template.HTMLEscapeString(c.User.Name)
diff --git a/app/store/comment_test.go b/app/store/comment_test.go
index 9597cba6..1ce03754 100644
--- a/app/store/comment_test.go
+++ b/app/store/comment_test.go
@@ -30,7 +30,7 @@ func TestComment_Sanitize(t *testing.T) {
User: User{ID: `username`},
},
out: Comment{
- Text: `blah https://www.reddit.com/r/gola...` + "\n\t",
+ Text: `blah https://www.reddit.com/r/golang/comments/8jdo...` + "\n\t",
User: User{ID: `<a href="http://blah.com">username</a>`},
},
},