diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-12-28 15:16:42 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-12-28 15:16:42 +0000 |
commit | b32176bce606d2a09326f7e391942ecfb8f1a74e (patch) | |
tree | 4c68da5dbec777a72fe1b5f4d274a596a2eba438 | |
parent | 0d930161525032b7289d480d3ee6924e3ef10e6f (diff) | |
parent | 7f1d954873263b5406bdd25afa02b06013cb70e3 (diff) | |
download | gitlab-ce-b32176bce606d2a09326f7e391942ecfb8f1a74e.tar.gz |
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
-rw-r--r-- | changelogs/unreleased/dz-improve-admin-group-routing.yml | 4 | ||||
-rw-r--r-- | config/routes/admin.rb | 2 | ||||
-rw-r--r-- | spec/routing/admin_routing_spec.rb | 10 |
3 files changed, 13 insertions, 3 deletions
diff --git a/changelogs/unreleased/dz-improve-admin-group-routing.yml b/changelogs/unreleased/dz-improve-admin-group-routing.yml new file mode 100644 index 00000000000..2360b965c90 --- /dev/null +++ b/changelogs/unreleased/dz-improve-admin-group-routing.yml @@ -0,0 +1,4 @@ +--- +title: Fix 500 error when visit group from admin area if group name contains dot +merge_request: +author: diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 0dd2c8f7aef..23295b43c92 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -32,7 +32,7 @@ namespace :admin do scope(path: 'groups/*id', 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 put :members_update diff --git a/spec/routing/admin_routing_spec.rb b/spec/routing/admin_routing_spec.rb index 661b671301e..99c44bde151 100644 --- a/spec/routing/admin_routing_spec.rb +++ b/spec/routing/admin_routing_spec.rb @@ -122,12 +122,18 @@ describe Admin::HealthCheckController, "routing" do end describe Admin::GroupsController, "routing" do + let(:name) { 'complex.group-namegit' } + it "to #index" do expect(get("/admin/groups")).to route_to('admin/groups#index') end it "to #show" do - expect(get("/admin/groups/gitlab")).to route_to('admin/groups#show', id: 'gitlab') - expect(get("/admin/groups/gitlab/subgroup")).to route_to('admin/groups#show', id: 'gitlab/subgroup') + expect(get("/admin/groups/#{name}")).to route_to('admin/groups#show', id: name) + 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 |