about summary refs log tree commit diff
path: root/app/validators/url_validator.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-01-05 18:44:15 +0100
committerGitHub <noreply@github.com>2023-01-05 18:44:15 +0100
commitad17e1944aa4c01c5637199b464c9d78b7e54af2 (patch)
treedee9d23334a0d23fbc3737e3c17033727805a141 /app/validators/url_validator.rb
parent7e9d5bdbb9125197afb5b3df69ce49a79451d697 (diff)
parentc4649ae9d4ef34cc0bad9d5df0da8e8b6c729522 (diff)
Merge pull request #2071 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/validators/url_validator.rb')
-rw-r--r--app/validators/url_validator.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/validators/url_validator.rb b/app/validators/url_validator.rb
index 75d1edb87..a90fb6958 100644
--- a/app/validators/url_validator.rb
+++ b/app/validators/url_validator.rb
@@ -10,5 +10,7 @@ class URLValidator < ActiveModel::EachValidator
   def compliant?(url)
     parsed_url = Addressable::URI.parse(url)
     parsed_url && %w(http https).include?(parsed_url.scheme) && parsed_url.host
+  rescue Addressable::URI::InvalidURIError
+    false
   end
 end