microcosm-cc / bluemonday

bluemonday: a fast golang HTML sanitizer (inspired by the OWASP Java HTML Sanitizer) to scrub user generated content of XSS
https://github.com/microcosm-cc/bluemonday
BSD 3-Clause "New" or "Revised" License
3.14k stars 176 forks source link

nit: func stringInSlice should use EqualsFold #94

Open riking opened 4 years ago

riking commented 4 years ago

https://staticcheck.io/docs/checks#SA6005

In file sanitize.go: if strings.ToLower(straw) == strings.ToLower(needle) { should be strings.EqualsFold(straw, needle)

or, even better, compile a regexp literal for needle and use it for the entire loop.