diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-10-16 12:49:23 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-10-16 12:49:23 +0300 |
commit | c48f7153181eab0d872d84b1c00e83cec5f2f046 (patch) | |
tree | 597d3198e41468b0901caff83f1cd9c60f9c0622 | |
parent | 59fd45557799fd62661750628277290d2b18da18 (diff) | |
download | gitlab-ce-c48f7153181eab0d872d84b1c00e83cec5f2f046.tar.gz |
Fix 404 when group path has dot in the namedz-fix-group-with-dot
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | config/routes/group.rb | 5 | ||||
-rw-r--r-- | spec/routing/routing_spec.rb | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/config/routes/group.rb b/config/routes/group.rb index 33143f0dfa2..06b464d79c8 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -1,7 +1,10 @@ require 'constraints/group_url_constrainer' constraints(GroupUrlConstrainer.new) do - scope(path: ':id', as: :group, controller: :groups) do + scope(path: ':id', + as: :group, + constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, + controller: :groups) do get '/', action: :show patch '/', action: :update put '/', action: :update diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index 0ee1c811dfb..488dc1a63b0 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -270,6 +270,12 @@ describe "Groups", "routing" do expect(get('/1')).to route_to('groups#show', id: '1') end + + it "also display group#show with dot in the path" do + allow(Group).to receive(:find_by_path).and_return(true) + + expect(get('/group.with.dot')).to route_to('groups#show', id: 'group.with.dot') + end end describe HealthCheckController, 'routing' do |