validate_url

in lib/crawler/url_validator/url_check_concern.rb [12:25]


    def validate_url 
      if url.scheme.blank?
        validation_fail(:url, 'URL scheme is missing. Domain URLs must start with https:// or http://')
      elsif !url.supported_scheme?
        validation_fail(:url, "Unsupported URL scheme: #{url.scheme}", scheme: url.scheme)
      elsif url.path.present? && !configuration
        validation_fail(:url, 'Domain URLs cannot contain a path')
      else
        validation_ok(:url, 'URL structure looks valid')
      end
    rescue Addressable::URI::InvalidURIError => e
      validation_fail(:url, "Error parsing domain name: #{e}")
    end