Skip to content

Commit 74bb905

Browse files
committed
fix
1 parent 79ead6b commit 74bb905

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

models/issues/comment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ func (c *Comment) EventTag() string {
544544
return fmt.Sprintf("event-%d", c.ID)
545545
}
546546

547-
func (c *Comment) GetSanitizeContentHTML() template.HTML {
547+
func (c *Comment) GetSanitizedContentHTML() template.HTML {
548548
// mainly for type=4 CommentTypeCommitRef
549549
// the content is a link like <a href="{RepoLink}/commit/{CommitID}">message title</a> (from CreateRefComment)
550550
return markup.Sanitize(c.Content)

routers/utils/utils_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package utils
55

66
import (
7+
"html/template"
78
"testing"
89

910
"github.com/stretchr/testify/assert"
@@ -13,7 +14,7 @@ func TestSanitizeFlashErrorString(t *testing.T) {
1314
tests := []struct {
1415
name string
1516
arg string
16-
want string
17+
want template.HTML
1718
}{
1819
{
1920
name: "no error",
@@ -28,7 +29,7 @@ func TestSanitizeFlashErrorString(t *testing.T) {
2829
{
2930
name: "line break error",
3031
arg: "some error:\n\nawesome!",
31-
want: "some error:<br><br>awesome!",
32+
want: "some error:\n\nawesome!",
3233
},
3334
}
3435

templates/repo/issue/view_content/comments.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
<div class="detail flex-text-block">
165165
{{svg "octicon-git-commit"}}
166166
{{/* the content is a link like <a href="{RepoLink}/commit/{CommitID}">message title</a> (from CreateRefComment) */}}
167-
<span class="comment-text-line">{{.GetSanitizeContentHTML}}</span>
167+
<span class="comment-text-line">{{.GetSanitizedContentHTML}}</span>
168168
</div>
169169
</div>
170170
{{else if eq .Type 7}}

0 commit comments

Comments
 (0)