mirror of
https://github.com/go-gitea/gitea
synced 2025-08-12 04:28:21 +00:00
Escape search query (Backport 1.4) (#3488)
* 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:
@@ -10,6 +10,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"html"
|
||||
"html/template"
|
||||
"mime"
|
||||
"net/url"
|
||||
@@ -179,6 +180,7 @@ func NewFuncMap() []template.FuncMap {
|
||||
return dict, nil
|
||||
},
|
||||
"Printf": fmt.Sprintf,
|
||||
"Escape": Escape,
|
||||
}}
|
||||
}
|
||||
|
||||
@@ -197,6 +199,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()
|
||||
|
Reference in New Issue
Block a user