Skip to content
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

Dig can cause weird exceptions #128

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/invisible_captcha/controller_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def honeypot_spam?(options = {})
# If honeypot is defined for this controller-action, search for:
# - honeypot: params[:subtitle]
# - honeypot with scope: params[:topic][:subtitle]
if params[honeypot].present? || params.dig(scope, honeypot).present?
if params[honeypot].present? || (params[scope] && params[scope][honeypot].present?)
warn_spam("Honeypot param '#{honeypot}' was present.")
return true
else
Expand All @@ -99,7 +99,7 @@ def honeypot_spam?(options = {})
end
else
InvisibleCaptcha.honeypots.each do |default_honeypot|
if params[default_honeypot].present? || params.dig(scope, default_honeypot).present?
if params[default_honeypot].present? || (params[scope] && params[scope][default_honeypot].present?)
warn_spam("Honeypot param '#{scope}.#{default_honeypot}' was present.")
return true
end
Expand Down