Dont allow ? in project path
Because it causes 500 error on every page where link to such project exists Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
ac1ff491b4
commit
6a0cb25096
2 changed files with 22 additions and 1 deletions
|
@ -72,7 +72,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def default_regex
|
||||
/\A[.?]?[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
|
||||
/\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
21
spec/lib/gitlab/regex_spec.rb
Normal file
21
spec/lib/gitlab/regex_spec.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue