From 7d752af6645778f79e3bea8121fdd24fe3aa41fa Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Sun, 1 Nov 2020 23:41:22 -0600 Subject: Check domain allow- and blocklist; rescue from invalid URIs --- app/helpers/domain_control_helper.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'app/helpers/domain_control_helper.rb') diff --git a/app/helpers/domain_control_helper.rb b/app/helpers/domain_control_helper.rb index 765ffa536..d061de492 100644 --- a/app/helpers/domain_control_helper.rb +++ b/app/helpers/domain_control_helper.rb @@ -12,11 +12,9 @@ module DomainControlHelper end end - if whitelist_mode? - !DomainAllow.allowed?(domain) - else - DomainBlock.blocked?(domain) - end + !DomainAllow.allowed?(domain) || DomainBlock.blocked?(domain) + rescue Addressable::URI::InvalidURIError, IDN::Idna::IdnaError + nil end def whitelist_mode? -- cgit