Merge branch 'issue_3076' into 'master'

Fix problem with projects ending with .keys #3076

Closes #3076

Move route `:username.keys` below project's routes. This allow project's to handle names ending with `.keys`

See merge request !1883
This commit is contained in:
Drew Blessing 2016-01-08 15:52:05 +00:00
commit c1e974ed88
3 changed files with 5 additions and 3 deletions

View file

@ -15,6 +15,7 @@ v 8.4.0 (unreleased)
- Add "Frequently used" category to emoji picker - Add "Frequently used" category to emoji picker
- Add CAS support (tduehr) - Add CAS support (tduehr)
- Add link to merge request on build detail page - Add link to merge request on build detail page
- Fix: Problem with projects ending with .keys (Jose Corcuera)
- Revert back upvote and downvote button to the issue and MR pages - Revert back upvote and downvote button to the issue and MR pages
- Swap position of Assignee and Author selector on Issuables (Zeger-Jan van de Weg) - Swap position of Assignee and Author selector on Issuables (Zeger-Jan van de Weg)
- Add system hook messages for project rename and transfer (Steve Norman) - Add system hook messages for project rename and transfer (Steve Norman)

View file

@ -52,9 +52,6 @@ Rails.application.routes.draw do
API::API.logger Rails.logger API::API.logger Rails.logger
mount API::API => '/api' mount API::API => '/api'
# Get all keys of user
get ':username.keys' => 'profiles/keys#get_keys' , constraints: { username: /.*/ }
constraint = lambda { |request| request.env['warden'].authenticate? and request.env['warden'].user.admin? } constraint = lambda { |request| request.env['warden'].authenticate? and request.env['warden'].user.admin? }
constraints constraint do constraints constraint do
mount Sidekiq::Web, at: '/admin/sidekiq', as: :sidekiq mount Sidekiq::Web, at: '/admin/sidekiq', as: :sidekiq
@ -686,5 +683,8 @@ Rails.application.routes.draw do
end end
end end
# Get all keys of user
get ':username.keys' => 'profiles/keys#get_keys' , constraints: { username: /.*/ }
get ':id' => 'namespaces#show', constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ } get ':id' => 'namespaces#show', constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }
end end

View file

@ -80,6 +80,7 @@ describe ProjectsController, 'routing' do
it 'to #show' do it 'to #show' do
expect(get('/gitlab/gitlabhq')).to route_to('projects#show', namespace_id: 'gitlab', id: 'gitlabhq') expect(get('/gitlab/gitlabhq')).to route_to('projects#show', namespace_id: 'gitlab', id: 'gitlabhq')
expect(get('/gitlab/gitlabhq.keys')).to route_to('projects#show', namespace_id: 'gitlab', id: 'gitlabhq.keys')
end end
it 'to #update' do it 'to #update' do