From ee6786216a608fca2de322c90c7256577f2a500a Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 30 Jan 2015 18:12:30 -0500 Subject: modules/base: clean code with #838 --- models/repo.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'models/repo.go') diff --git a/models/repo.go b/models/repo.go index 65689b6a..58c099d4 100644 --- a/models/repo.go +++ b/models/repo.go @@ -7,7 +7,6 @@ package models import ( "errors" "fmt" - "html" "html/template" "io/ioutil" "os" @@ -218,11 +217,9 @@ func (repo *Repository) HasAccess(uname string) bool { // DescriptionHtml does special handles to description and return HTML string. func (repo *Repository) DescriptionHtml() template.HTML { sanitize := func(s string) string { - // TODO(nuss-justin): Improve sanitization. Strip all tags? - ss := html.EscapeString(s) - return fmt.Sprintf(`%s`, ss, ss) + return fmt.Sprintf(`%[1]s`, s) } - return template.HTML(DescPattern.ReplaceAllStringFunc(base.XSSString(repo.Description), sanitize)) + return template.HTML(DescPattern.ReplaceAllStringFunc(base.Sanitizer.Sanitize(repo.Description), sanitize)) } // IsRepositoryExist returns true if the repository with given name under user has already existed. -- cgit v1.2.3