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