diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 2879d68e3..a8e407524 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -377,17 +377,17 @@ func NewFuncMap() []template.FuncMap { return "" }, "RenderLabels": func(labels []*issues_model.Label, repoLink string) template.HTML { - html := `` + htmlCode := `` for _, label := range labels { // Protect against nil value in labels - shouldn't happen but would cause a panic if so if label == nil { continue } - html += fmt.Sprintf("%s ", - repoLink, label.ID, label.ForegroundColor(), label.Color, RenderEmoji(label.Name)) + htmlCode += fmt.Sprintf("%s ", + repoLink, label.ID, label.ForegroundColor(), label.Color, html.EscapeString(label.Description), RenderEmoji(label.Name)) } - html += "" - return template.HTML(html) + htmlCode += "" + return template.HTML(htmlCode) }, "MermaidMaxSourceCharacters": func() int { return setting.MermaidMaxSourceCharacters