Commit 94c9dc51 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'dz-fix-group-with-dot' into 'master'

Fix 404 when group path has dot in the name

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/23401

See merge request !6919
parents 59fd4555 c48f7153
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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment