From 6a0cb250966e3bca5bd0dcda82505bfd905167a7 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 8 Jul 2014 18:15:23 +0300 Subject: Dont allow ? in project path Because it causes 500 error on every page where link to such project exists Signed-off-by: Dmitriy Zaporozhets --- spec/lib/gitlab/regex_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spec/lib/gitlab/regex_spec.rb (limited to 'spec/lib/gitlab/regex_spec.rb') diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb new file mode 100644 index 00000000000..a3aae7771bd --- /dev/null +++ b/spec/lib/gitlab/regex_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe Gitlab::Regex do + describe 'path regex' do + it { 'gitlab-ce'.should match(Gitlab::Regex.path_regex) } + it { 'gitlab_git'.should match(Gitlab::Regex.path_regex) } + it { '_underscore.js'.should match(Gitlab::Regex.path_regex) } + it { '100px.com'.should match(Gitlab::Regex.path_regex) } + it { '?gitlab'.should_not match(Gitlab::Regex.path_regex) } + it { 'git lab'.should_not match(Gitlab::Regex.path_regex) } + it { 'gitlab.git'.should_not match(Gitlab::Regex.path_regex) } + end + + describe 'project name regex' do + it { 'gitlab-ce'.should match(Gitlab::Regex.project_name_regex) } + it { 'GitLab CE'.should match(Gitlab::Regex.project_name_regex) } + it { '100 lines'.should match(Gitlab::Regex.project_name_regex) } + it { 'gitlab.git'.should match(Gitlab::Regex.project_name_regex) } + it { '?gitlab'.should_not match(Gitlab::Regex.project_name_regex) } + end +end -- cgit v1.2.3