diff --git a/backend/app/store/formatter.go b/backend/app/store/formatter.go index 613cb272..0522eef9 100644 --- a/backend/app/store/formatter.go +++ b/backend/app/store/formatter.go @@ -37,7 +37,6 @@ func NewCommentFormatter(converters ...CommentConverter) *CommentFormatter { // Format comment fields func (f *CommentFormatter) Format(c Comment) Comment { c.Text = f.FormatText(c.Text) - c.Locator.URL = c.sanitizeAsURL(c.Locator.URL) // for urls prior to #927s return c } diff --git a/backend/app/store/formatter_test.go b/backend/app/store/formatter_test.go index 68a35b6c..24f63834 100644 --- a/backend/app/store/formatter_test.go +++ b/backend/app/store/formatter_test.go @@ -77,27 +77,6 @@ func TestFormatter_FormatComment(t *testing.T) { assert.Equal(t, exp, f.Format(comment)) } -func TestFormatter_FormatCommentXSSLocator(t *testing.T) { - comment := Comment{ - Text: "blah\n\nxyz", - User: User{ID: "username"}, - ParentID: "p123", - ID: "123", - Locator: Locator{SiteID: "site", URL: "javascript:alert('XSS1')"}, - Score: 10, - Pin: true, - Deleted: true, - Timestamp: time.Date(2018, 1, 1, 9, 30, 0, 0, time.Local), - Votes: map[string]bool{"uu": true}, - } - - f := NewCommentFormatter(mockConverter{}) - exp := comment - exp.Text = "

blah

\n\n

xyz

\n!converted" - exp.Locator.URL = "" - assert.Equal(t, exp, f.Format(comment)) -} - func TestFormatter_ShortenAutoLinks(t *testing.T) { f := NewCommentFormatter(nil) tbl := []struct {