Commit 0f17f745 authored by James Lopez's avatar James Lopez

Merge branch '342150-allow-hyphen-in-gl-subdomains' into 'master'

Support hyphens in GitLab subdomain regex

See merge request gitlab-org/gitlab!79158
parents 82f1ec0f 594d42a7
......@@ -18,7 +18,7 @@ module Gitlab
end
def self.subdomain_regex
%r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}.freeze
%r{\Ahttps://[a-z0-9-]+\.gitlab\.com\z}.freeze
end
def self.dev_url
......
......@@ -99,6 +99,13 @@ RSpec.describe Gitlab do
expect(described_class.com?).to eq true
end
it 'is true when on other gitlab subdomain with hyphen' do
url_with_subdomain = Gitlab::Saas.com_url.gsub('https://', 'https://test-example.')
stub_config_setting(url: url_with_subdomain)
expect(described_class.com?).to eq true
end
it 'is false when not on GitLab.com' do
stub_config_setting(url: 'http://example.com')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment