Sha256: 35c5b1dbd5f3edfbb5cec0517ecf945806ed02767a2ef43d60d7c578d590cc7b

Contents?: true

Size: 500 Bytes

Versions: 3

Compression:

Stored size: 500 Bytes

Contents

module Katello
  module KatelloURLHelper
    unless defined? CONSTANTS_DEFINED
      FILEPREFIX = ['file'].freeze
      PROTOCOLS = ['http', 'https', 'ftp', 'uln'].freeze

      CONSTANTS_DEFINED = true
    end

    def kurl_valid?(url)
      return false if (scheme = URI.parse(url).scheme).blank?
      return true if FILEPREFIX.include?(scheme.downcase)
      URI.parse(url).host.present? && PROTOCOLS.include?(scheme.downcase)
    rescue URI::InvalidURIError
      return false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-4.15.0 app/helpers/katello/katello_url_helper.rb
katello-4.15.0.rc2 app/helpers/katello/katello_url_helper.rb
katello-4.15.0.rc1 app/helpers/katello/katello_url_helper.rb