Commit aa3c7219 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'fix-api-lookup-with-usernames-with-dots' of https://gitlab.com/stanhu/gitlab-ce

parents 7f2127ee 086cfc86
...@@ -17,6 +17,7 @@ v 8.4.0 (unreleased) ...@@ -17,6 +17,7 @@ v 8.4.0 (unreleased)
- Add system hook messages for project rename and transfer (Steve Norman) - Add system hook messages for project rename and transfer (Steve Norman)
- Fix version check image in Safari - Fix version check image in Safari
- Show 'All' tab by default in the builds page - Show 'All' tab by default in the builds page
- Fix API project lookups when querying with a namespace with dots (Stan Hu)
v 8.3.3 (unreleased) v 8.3.3 (unreleased)
- Fix project transfer e-mail sending incorrect paths in e-mail notification (Stan Hu) - Fix project transfer e-mail sending incorrect paths in e-mail notification (Stan Hu)
......
...@@ -3,7 +3,7 @@ module API ...@@ -3,7 +3,7 @@ module API
class Projects < Grape::API class Projects < Grape::API
before { authenticate! } before { authenticate! }
resource :projects do resource :projects, requirements: { id: /[^\/]+/ } do
helpers do helpers do
def map_public_to_visibility_level(attrs) def map_public_to_visibility_level(attrs)
publik = attrs.delete(:public) publik = attrs.delete(:public)
......
...@@ -382,6 +382,15 @@ describe API::API, api: true do ...@@ -382,6 +382,15 @@ describe API::API, api: true do
expect(response.status).to eq(404) expect(response.status).to eq(404)
end end
it 'should handle users with dots' do
dot_user = create(:user, username: 'dot.user')
project = create(:project, creator_id: dot_user.id, namespace: dot_user.namespace)
get api("/projects/#{dot_user.namespace.name}%2F#{project.path}", dot_user)
expect(response.status).to eq(200)
expect(json_response['name']).to eq(project.name)
end
describe 'permissions' do describe 'permissions' do
context 'all projects' do context 'all projects' do
it 'Contains permission information' do it 'Contains permission information' 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