diff --git a/src/api/app/controllers/source_project_controller.rb b/src/api/app/controllers/source_project_controller.rb index 5eed128a291a..0654ea097da6 100644 --- a/src/api/app/controllers/source_project_controller.rb +++ b/src/api/app/controllers/source_project_controller.rb @@ -4,17 +4,15 @@ class SourceProjectController < SourceController # GET /source/:project def show project_name = params[:project] - if params.key?(:deleted) + + if params[:deleted] == '1' unless Project.find_by_name(project_name) || Project.is_remote_project?(project_name) # project is deleted or not accessible validate_visibility_of_deleted_project(project_name) end - pass_to_backend - return end - if Project.is_remote_project?(project_name) - # not a local project, hand over to backend + unless params.key?(:view) pass_to_backend return end @@ -23,27 +21,22 @@ def show raise Project::UnknownObjectError, "Project not found: #{project_name}" unless @project # we let the backend list the packages after we verified the project is visible - if params.key?(:view) - case params[:view] - when 'verboseproductlist' - @products = Product.all_products(@project, params[:expand]) - render 'source/verboseproductlist', formats: [:xml] - return - when 'productlist' - @products = Product.all_products(@project, params[:expand]) - render 'source/productlist', formats: [:xml] - return - when 'issues' - render_project_issues - when 'info' - pass_to_backend - else - raise InvalidParameterError, "'#{params[:view]}' is not a valid 'view' parameter value." - end + case params[:view] + when 'verboseproductlist' + @products = Product.all_products(@project, params[:expand]) + render 'source/verboseproductlist', formats: [:xml] + return + when 'productlist' + @products = Product.all_products(@project, params[:expand]) + render 'source/productlist', formats: [:xml] return + when 'issues' + render_project_issues + when 'info' + pass_to_backend + else + raise InvalidParameterError, "'#{params[:view]}' is not a valid 'view' parameter value." end - - render_project_packages end def render_project_issues @@ -51,11 +44,6 @@ def render_project_issues render partial: 'source/project_issues', formats: [:xml] end - def render_project_packages - @packages = params.key?(:expand) ? @project.expand_all_packages : @project.packages.pluck(:name) - render locals: { expand: params.key?(:expand) }, formats: [:xml] - end - # DELETE /source/:project def delete project = Project.get_by_name(params[:project])