about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-11-01 23:41:22 -0600
committerFire Demon <firedemon@creature.cafe>2020-11-01 23:41:22 -0600
commit7d752af6645778f79e3bea8121fdd24fe3aa41fa (patch)
tree9601279d73bfb2790d5f4c5cd30b350b6cfe2629 /app/helpers
parent62091f53f1960ca964e6ed2fd03901ffbd27d7a9 (diff)
Check domain allow- and blocklist; rescue from invalid URIs
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/domain_control_helper.rb8
1 files changed, 3 insertions, 5 deletions
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?