summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-01-09 09:03:43 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-01-09 09:03:43 +0000
commita04ef4db58cb1719ae9c47826f8deb05a3251b52 (patch)
treeb66a8089f57f1bf273993b0afbbbcbbcfc308527
parent1086983df80ae8f572d8520b0708441479bcc701 (diff)
parentc519e4a7286e838d2ef56d4ca4841e5b9b7bc1a2 (diff)
downloadgitlab-ce-a04ef4db58cb1719ae9c47826f8deb05a3251b52.tar.gz
Merge branch 'check-environment-regex-ce' into 'master'
Backport "Fix environment scope regex" to CE Closes gitlab-ee#4308 See merge request gitlab-org/gitlab-ce!15945
-rw-r--r--lib/gitlab/regex.rb2
-rw-r--r--spec/lib/gitlab/regex_spec.rb3
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index 2c7b8af83f2..0002c7da8f1 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -37,7 +37,7 @@ module Gitlab
end
def environment_name_regex_chars
- 'a-zA-Z0-9_/\\$\\{\\}\\. -'
+ 'a-zA-Z0-9_/\\$\\{\\}\\. \\-'
end
def environment_name_regex
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb
index 68a57826647..8b54d72d6f7 100644
--- a/spec/lib/gitlab/regex_spec.rb
+++ b/spec/lib/gitlab/regex_spec.rb
@@ -14,7 +14,7 @@ describe Gitlab::Regex do
it { is_expected.not_to match('?gitlab') }
end
- describe '.environment_slug_regex' do
+ describe '.environment_name_regex' do
subject { described_class.environment_name_regex }
it { is_expected.to match('foo') }
@@ -24,6 +24,7 @@ describe Gitlab::Regex do
it { is_expected.to match('foo.1') }
it { is_expected.not_to match('9&foo') }
it { is_expected.not_to match('foo-^') }
+ it { is_expected.not_to match('!!()()') }
end
describe '.environment_slug_regex' do