Sha256: b10ba7a47adfe327832bf7bdb2f3d2378adbda85fc65e6ef64cd10f23627366d

Contents?: true

Size: 530 Bytes

Versions: 16

Compression:

Stored size: 530 Bytes

Contents

module ShopifyApp
  module Utils

    def self.sanitize_shop_domain(shop_domain)
      name = shop_domain.to_s.downcase.strip
      name += ".#{ShopifyApp.configuration.myshopify_domain}" if !name.include?("#{ShopifyApp.configuration.myshopify_domain}") && !name.include?(".")
      name.sub!(%r|https?://|, '')

      u = URI("http://#{name}")
      u.host if u.host&.match(/^[a-z0-9][a-z0-9\-]*[a-z0-9]\.#{Regexp.escape(ShopifyApp.configuration.myshopify_domain)}$/)
    rescue URI::InvalidURIError
      nil
    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
shopify_app-11.0.2 lib/shopify_app/utils.rb
shopify_app-11.0.1 lib/shopify_app/utils.rb
shopify_app-11.0.0 lib/shopify_app/utils.rb
shopify_app-10.0.0 lib/shopify_app/utils.rb
shopify_app-9.0.4 lib/shopify_app/utils.rb
shopify_app-9.0.3 lib/shopify_app/utils.rb
shopify_app-9.0.2 lib/shopify_app/utils.rb
shopify_app-9.0.1 lib/shopify_app/utils.rb
shopify_app-9.0.0 lib/shopify_app/utils.rb
shopify_app-8.6.1 lib/shopify_app/utils.rb
shopify_app-8.6.0 lib/shopify_app/utils.rb
shopify_app-8.5.1 lib/shopify_app/utils.rb
shopify_app-8.5.0 lib/shopify_app/utils.rb
shopify_app-8.4.2 lib/shopify_app/utils.rb
shopify_app-8.4.1 lib/shopify_app/utils.rb
shopify_app-8.4.0 lib/shopify_app/utils.rb