handlebars-helpers
handlebars-helpers copied to clipboard
sanitize fails at invalid html
I've been using the sanitize helper in BigCommerce to get clean text from html. We just encountered an error that I've narrowed down to an issue with handling invalid html.
Example input:
<p>
before bug<img test"="">after bug
</p>
I've added a deliberate mistake with the syntax of the img attribute, adding a random double quote.
This causes the sanitize to stop at that syntax error and only output text from before it. e.g. "before bug".
It would be nicer if it was more robust.