1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-12 04:28:21 +00:00

Escape search query (Backport 1.3) (#3489)

* 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>
This commit is contained in:
Jonas Franz
2018-02-11 17:24:53 +01:00
committed by Lauris BH
parent 88c363f933
commit ed27da4b0a
2 changed files with 8 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import (
"container/list"
"encoding/json"
"fmt"
"html"
"html/template"
"mime"
"path/filepath"
@@ -162,6 +163,7 @@ func NewFuncMap() []template.FuncMap {
"UnescapeLocale": func(str string) string {
return strings.NewReplacer("\\;", ";", "\\#", "#").Replace(str)
},
"Escape": Escape,
}}
}
@@ -180,6 +182,11 @@ func Str2html(raw string) template.HTML {
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()