You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From Sanitize's point of view, the transformer argument is a lambda and has a call() method, so it's a valid argument. An ArgumentError in this case would be misleading.
The problem is that the lambda contains a syntax error, and the resulting exception is unintuitive and broken, so that's the part that needs fixing. We'll need to make sure Sanitize bubbles up meaningful exceptions when there are problems inside transformers.
Returning anything other than a Hash or nil from a transformer will now raise a meaningful Sanitize::Error exception rather than an unintended NameError. Closed by 0a8e5f2
When i use plain Sanitize and provide a bad transformer, i get the above exception. Maybe you could raise the standard ArgumentError or the like.
Reproduce:
Sanitize.clean("<script>fail();</script>", :transformers => lambda {|env| :badtransformer })
The text was updated successfully, but these errors were encountered: