Merge branch 'dz-improve-admin-group-routing' into 'master'

Fix 500 error when visit group from admin area if group name contains dot

See merge request !8342
This commit is contained in:
Sean McGivern 2016-12-28 15:16:42 +00:00
commit b32176bce6
3 changed files with 13 additions and 3 deletions

View file

@ -0,0 +1,4 @@
---
title: Fix 500 error when visit group from admin area if group name contains dot
merge_request:
author:

View file

@ -32,7 +32,7 @@ namespace :admin do
scope(path: 'groups/*id', scope(path: 'groups/*id',
controller: :groups, controller: :groups,
constraints: { id: Gitlab::Regex.namespace_route_regex }) do constraints: { id: Gitlab::Regex.namespace_route_regex, format: /(html|json|atom)/ }) do
scope(as: :group) do scope(as: :group) do
put :members_update put :members_update

View file

@ -122,12 +122,18 @@ describe Admin::HealthCheckController, "routing" do
end end
describe Admin::GroupsController, "routing" do describe Admin::GroupsController, "routing" do
let(:name) { 'complex.group-namegit' }
it "to #index" do it "to #index" do
expect(get("/admin/groups")).to route_to('admin/groups#index') expect(get("/admin/groups")).to route_to('admin/groups#index')
end end
it "to #show" do it "to #show" do
expect(get("/admin/groups/gitlab")).to route_to('admin/groups#show', id: 'gitlab') expect(get("/admin/groups/#{name}")).to route_to('admin/groups#show', id: name)
expect(get("/admin/groups/gitlab/subgroup")).to route_to('admin/groups#show', id: 'gitlab/subgroup') expect(get("/admin/groups/#{name}/subgroup")).to route_to('admin/groups#show', id: "#{name}/subgroup")
end
it "to #edit" do
expect(get("/admin/groups/#{name}/edit")).to route_to('admin/groups#edit', id: name)
end end
end end