diff options
Diffstat (limited to 'lib/api/helpers/internal_helpers.rb')
-rw-r--r-- | lib/api/helpers/internal_helpers.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb index f7aabc8ce4f..31272c537a3 100644 --- a/lib/api/helpers/internal_helpers.rb +++ b/lib/api/helpers/internal_helpers.rb @@ -3,7 +3,7 @@ module API module Helpers module InternalHelpers - attr_reader :redirected_path, :container + attr_reader :redirected_path delegate :wiki?, to: :repo_type @@ -11,15 +11,22 @@ module API @actor ||= Support::GitAccessActor.from_params(params) end + # rubocop:disable Gitlab/ModuleWithInstanceVariables def repo_type - set_project unless defined?(@repo_type) # rubocop:disable Gitlab/ModuleWithInstanceVariables - @repo_type # rubocop:disable Gitlab/ModuleWithInstanceVariables + parse_repo_path unless defined?(@repo_type) + @repo_type end def project - set_project unless defined?(@project) # rubocop:disable Gitlab/ModuleWithInstanceVariables - @project # rubocop:disable Gitlab/ModuleWithInstanceVariables + parse_repo_path unless defined?(@project) + @project + end + + def container + parse_repo_path unless defined?(@container) + @container end + # rubocop:enable Gitlab/ModuleWithInstanceVariables def access_checker_for(actor, protocol) access_checker_klass.new(actor.key_or_user, container, protocol, @@ -79,7 +86,7 @@ module API end # rubocop:disable Gitlab/ModuleWithInstanceVariables - def set_project + def parse_repo_path @container, @project, @repo_type, @redirected_path = if params[:gl_repository] Gitlab::GlRepository.parse(params[:gl_repository]) |