diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-24 21:10:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-24 21:10:28 +0300 |
commit | e20fed01c86f47ffba316483f312a36330fd084d (patch) | |
tree | a97c23d9f1729ca3637c78769ebe1663e0765bb7 /lib | |
parent | e778dcbceebbfbae42a3743cf76d80229ccc716c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities/package.rb | 2 | ||||
-rw-r--r-- | lib/api/project_packages.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/api/entities/package.rb b/lib/api/entities/package.rb index c92a4677220..ab6cc0fcb0a 100644 --- a/lib/api/entities/package.rb +++ b/lib/api/entities/package.rb @@ -26,7 +26,7 @@ module API expose :status, documentation: { type: 'string', example: 'default' } expose :_links do - expose :web_path do |package| + expose :web_path, if: ->(package) { package.default? } do |package| package_path(package) end diff --git a/lib/api/project_packages.rb b/lib/api/project_packages.rb index 99bf0acdd93..158ba7465f4 100644 --- a/lib/api/project_packages.rb +++ b/lib/api/project_packages.rb @@ -69,6 +69,8 @@ module API package = ::Packages::PackageFinder .new(user_project, params[:package_id]).execute + render_api_error!('Package not found', 404) unless package.default? + present package, with: ::API::Entities::Package, user: current_user, namespace: user_project.namespace end |