Commit 76d7cd36 authored by Sean McGivern's avatar Sean McGivern

Merge branch '36423-fix-nuget-group-api-url' into 'master'

Fix the nuget group level API url prefix

See merge request gitlab-org/gitlab!51686
parents 2d93501b fad0be39
......@@ -100,7 +100,7 @@ module Packages
case scope
when :group
api_v4_groups_packages_nuget_metadata_package_name_package_version_path(
api_v4_groups___packages_nuget_metadata_package_name_package_version_path(
params,
true
)
......@@ -115,7 +115,7 @@ module Packages
def search_service_url
case scope
when :group
api_v4_groups_packages_nuget_query_path(id: @project_or_group.id)
api_v4_groups___packages_nuget_query_path(id: @project_or_group.id)
when :project
api_v4_projects_packages_nuget_query_path(id: @project_or_group.id)
end
......
......@@ -123,7 +123,7 @@ nuget source Add -Name "GitLab" -Source "https://gitlab.example.com/api/v4/proje
To use the [group-level](#use-the-gitlab-endpoint-for-nuget-packages) NuGet endpoint, add the Package Registry as a source with `nuget`:
```shell
nuget source Add -Name <source_name> -Source "https://gitlab.example.com/api/v4/groups/<your_group_id>/packages/nuget/index.json" -UserName <gitlab_username or deploy_token_username> -Password <gitlab_personal_access_token or deploy_token>
nuget source Add -Name <source_name> -Source "https://gitlab.example.com/api/v4/groups/<your_group_id>/-/packages/nuget/index.json" -UserName <gitlab_username or deploy_token_username> -Password <gitlab_personal_access_token or deploy_token>
```
- `<source_name>` is the desired source name.
......@@ -131,7 +131,7 @@ nuget source Add -Name <source_name> -Source "https://gitlab.example.com/api/v4/
For example:
```shell
nuget source Add -Name "GitLab" -Source "https://gitlab.example.com/api/v4/groups/23/packages/nuget/index.json" -UserName carol -Password 12345678asdf
nuget source Add -Name "GitLab" -Source "https://gitlab.example.com/api/v4/groups/23/-/packages/nuget/index.json" -UserName carol -Password 12345678asdf
```
### Add a source with Visual Studio
......@@ -173,7 +173,7 @@ To use the [group-level](#use-the-gitlab-endpoint-for-nuget-packages) NuGet endp
1. Select **Add**.
1. Complete the following fields:
- **Name**: Name for the source.
- **Location**: `https://gitlab.example.com/api/v4/group/<your_group_id>/packages/nuget/index.json`,
- **Location**: `https://gitlab.example.com/api/v4/groups/<your_group_id>/-/packages/nuget/index.json`,
where `<your_group_id>` is your group ID, and `gitlab.example.com` is
your domain name.
- **Username**: Your GitLab username or deploy token username.
......@@ -227,7 +227,7 @@ To use the [group-level](#use-the-gitlab-endpoint-for-nuget-packages) Package Re
<configuration>
<packageSources>
<clear />
<add key="gitlab" value="https://gitlab.example.com/api/v4/group/<your_group_id>/packages/nuget/index.json" />
<add key="gitlab" value="https://gitlab.example.com/api/v4/groups/<your_group_id>/-/packages/nuget/index.json" />
</packageSources>
<packageSourceCredentials>
<gitlab>
......
......@@ -45,7 +45,7 @@ module API
end
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
namespace ':id/packages/nuget' do
namespace ':id/-/packages/nuget' do
after_validation do
# This API can't be accessed anonymously
require_authenticated!
......
......@@ -15,27 +15,27 @@ RSpec.describe API::NugetGroupPackages do
let(:target_type) { 'groups' }
shared_examples 'handling all endpoints' do
describe 'GET /api/v4/groups/:id/packages/nuget' do
describe 'GET /api/v4/groups/:id/-/packages/nuget' do
it_behaves_like 'handling nuget service requests', anonymous_requests_example_name: 'rejects nuget packages access', anonymous_requests_status: :unauthorized do
let(:url) { "/groups/#{target.id}/packages/nuget/index.json" }
let(:url) { "/groups/#{target.id}/-/packages/nuget/index.json" }
end
end
describe 'GET /api/v4/groups/:id/packages/nuget/metadata/*package_name/index' do
describe 'GET /api/v4/groups/:id/-/packages/nuget/metadata/*package_name/index' do
it_behaves_like 'handling nuget metadata requests with package name', anonymous_requests_example_name: 'rejects nuget packages access', anonymous_requests_status: :unauthorized do
let(:url) { "/groups/#{target.id}/packages/nuget/metadata/#{package_name}/index.json" }
let(:url) { "/groups/#{target.id}/-/packages/nuget/metadata/#{package_name}/index.json" }
end
end
describe 'GET /api/v4/groups/:id/packages/nuget/metadata/*package_name/*package_version' do
describe 'GET /api/v4/groups/:id/-/packages/nuget/metadata/*package_name/*package_version' do
it_behaves_like 'handling nuget metadata requests with package name and package version', anonymous_requests_example_name: 'rejects nuget packages access', anonymous_requests_status: :unauthorized do
let(:url) { "/groups/#{target.id}/packages/nuget/metadata/#{package_name}/#{package.version}.json" }
let(:url) { "/groups/#{target.id}/-/packages/nuget/metadata/#{package_name}/#{package.version}.json" }
end
end
describe 'GET /api/v4/groups/:id/packages/nuget/query' do
describe 'GET /api/v4/groups/:id/-/packages/nuget/query' do
it_behaves_like 'handling nuget search requests', anonymous_requests_example_name: 'rejects nuget packages access', anonymous_requests_status: :unauthorized do
let(:url) { "/groups/#{target.id}/packages/nuget/query?#{query_parameters.to_query}" }
let(:url) { "/groups/#{target.id}/-/packages/nuget/query?#{query_parameters.to_query}" }
end
end
end
......@@ -94,21 +94,21 @@ RSpec.describe API::NugetGroupPackages do
end
end
describe 'GET /api/v4/groups/:id/packages/nuget/metadata/*package_name/index' do
describe 'GET /api/v4/groups/:id/-/packages/nuget/metadata/*package_name/index' do
it_behaves_like 'handling mixed visibilities' do
let(:url) { "/groups/#{target.id}/packages/nuget/metadata/#{package_name}/index.json" }
let(:url) { "/groups/#{target.id}/-/packages/nuget/metadata/#{package_name}/index.json" }
end
end
describe 'GET /api/v4/groups/:id/packages/nuget/metadata/*package_name/*package_version' do
describe 'GET /api/v4/groups/:id/-/packages/nuget/metadata/*package_name/*package_version' do
it_behaves_like 'handling mixed visibilities' do
let(:url) { "/groups/#{target.id}/packages/nuget/metadata/#{package_name}/#{packages.first.version}.json" }
let(:url) { "/groups/#{target.id}/-/packages/nuget/metadata/#{package_name}/#{packages.first.version}.json" }
end
end
describe 'GET /api/v4/groups/:id/packages/nuget/query' do
describe 'GET /api/v4/groups/:id/-/packages/nuget/query' do
it_behaves_like 'handling mixed visibilities' do
let(:url) { "/groups/#{target.id}/packages/nuget/query?#{query_parameters.to_query}" }
let(:url) { "/groups/#{target.id}/-/packages/nuget/query?#{query_parameters.to_query}" }
end
end
end
......
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