gitlink-forgeplus/app/controllers/concerns/api/project_helper.rb

21 lines
505 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module Api::ProjectHelper
extend ActiveSupport::Concern
def load_project
namespace = params[:owner]
repo = params[:repo]
@project, @owner = Project.find_with_namespace(namespace, repo)
@repository = @project&.repository
if @project
logger.info "###########project founded"
@project
else
logger.info "###########project not found"
@project = nil
tip_exception(404, '您访问的页面不存在或已被删除')
end
@project
end
end