hCaptcha / hcaptcha-wordpress-plugin

hCaptcha.com support for Wordpress (Plugin)
GNU General Public License v2.0
79 stars 32 forks source link

Fix hcaptcha-divi.js by adding a type guard #326

Closed angelsvirkov closed 6 months ago

angelsvirkov commented 6 months ago

Adding a simple type guard to avoid reaching uncaught exceptions by calling .includes on a potentially any type of object.

⚠️ I am not 100% sure what is the idea of this function but it looks like it is trying to not attach hCaptcha events in certain cases. That brings me to the question if there are other cases where that condition should be triggered. E.g. file upload submissions.

In other words, this PR only makes the code not crash, but has no impact on the current logic which might be missing some business cases.

Related Issue: Related to https://github.com/hCaptcha/hcaptcha-wordpress-plugin/issues/325