* Escape search query
Signed-off-by: Jonas Franz <info@jonasfranz.de>
(cherry picked from commit
2970889)
* Reordered imports
Signed-off-by: Jonas Franz <info@jonasfranz.de>
"encoding/json"
"errors"
"fmt"
+ "html"
"html/template"
"mime"
"net/url"
return dict, nil
},
"Printf": fmt.Sprintf,
+ "Escape": Escape,
}}
}
return template.HTML(markup.Sanitize(raw))
}
+// Escape escapes a HTML string
+func Escape(raw string) string {
+ return html.EscapeString(raw)
+}
+
// List traversings the list
func List(l *list.List) chan interface{} {
e := l.Front()
</div>
{{if .Keyword}}
<h3>
- {{.i18n.Tr "repo.search.results" .Keyword .RepoLink .RepoName | Str2html}}
+ {{.i18n.Tr "repo.search.results" (.Keyword|Escape) .RepoLink .RepoName | Str2html }}
</h3>
<div class="repository search">
{{range $result := .SearchResults}}