-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added function to escape string in failure message title and descriptions #551
Conversation
pkg/report/writer.go
Outdated
tmpl, err := template.New("output template").Parse(outputTemplate) | ||
tmpl, err := template.New("output template").Funcs(template.FuncMap{ | ||
"escapeString": func(input string) string { | ||
return html.EscapeString(input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we use xml.EscapeText?
https://golang.org/pkg/encoding/xml/#EscapeText
In that case, escapeXML
is preferred rather than escapeString
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@knqyf263 done, updated tests passing
pkg/report/writer.go
Outdated
@@ -41,7 +43,16 @@ func WriteResults(format string, output io.Writer, results Results, outputTempla | |||
case "json": | |||
writer = &JsonWriter{Output: output} | |||
case "template": | |||
tmpl, err := template.New("output template").Parse(outputTemplate) | |||
tmpl, err := template.New("output template").Funcs(template.FuncMap{ | |||
"escapeString": func(input string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said, I think escapeXML
is preferred because we might escape HTML or other formats other than XML.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@knqyf263 Thanks, check now
@rahul2393 Thanks a lot! |
…ions (#551) * Added function to escape string in failure message title and descriptions * updated template to use xml.EscapeText * Renamed template function
* fix: support for helm chart *.tar.gz - add test to validate Signed-off-by: Owen Rumney <[email protected]> * fix: adding missing test tar Signed-off-by: Owen Rumney <[email protected]>
* fix: support for helm chart *.tar.gz - add test to validate Signed-off-by: Owen Rumney <[email protected]> * fix: adding missing test tar Signed-off-by: Owen Rumney <[email protected]>
Issue
Related: #541