Accept dots in project name in project templates endpoint

parent 6f1d54d3
......@@ -12,7 +12,7 @@ module API
requires :id, type: String, desc: 'The ID of a project'
requires :type, type: String, values: TEMPLATE_TYPES, desc: 'The type (dockerfiles|gitignores|gitlab_ci_ymls|licenses) of the template'
end
resource :projects do
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
desc 'Get a list of templates available to this project' do
detail 'This endpoint was introduced in GitLab 11.4'
end
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe API::ProjectTemplates do
let_it_be(:public_project) { create(:project, :public) }
let_it_be(:public_project) { create(:project, :public, path: 'path.with.dot') }
let_it_be(:private_project) { create(:project, :private) }
let_it_be(:developer) { create(:user) }
......@@ -12,6 +12,12 @@ describe API::ProjectTemplates do
end
describe 'GET /projects/:id/templates/:type' do
it 'accepts project paths with dots' do
get api("/projects/#{public_project.namespace.path}%2F#{public_project.path}/templates/dockerfiles")
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns dockerfiles' do
get api("/projects/#{public_project.id}/templates/dockerfiles")
......
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