diff options
Diffstat (limited to 'app/controllers/repositories')
-rw-r--r-- | app/controllers/repositories/git_http_client_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/repositories/git_http_controller.rb | 7 | ||||
-rw-r--r-- | app/controllers/repositories/lfs_api_controller.rb | 22 |
3 files changed, 23 insertions, 12 deletions
diff --git a/app/controllers/repositories/git_http_client_controller.rb b/app/controllers/repositories/git_http_client_controller.rb index ec854bd0dde..a5b81054ee4 100644 --- a/app/controllers/repositories/git_http_client_controller.rb +++ b/app/controllers/repositories/git_http_client_controller.rb @@ -87,8 +87,12 @@ module Repositories @project end + def repository_path + @repository_path ||= params[:repository_path] + end + def parse_repo_path - @container, @project, @repo_type, @redirected_path = Gitlab::RepoPath.parse("#{params[:namespace_id]}/#{params[:repository_id]}") + @container, @project, @repo_type, @redirected_path = Gitlab::RepoPath.parse(repository_path) end def render_missing_personal_access_token diff --git a/app/controllers/repositories/git_http_controller.rb b/app/controllers/repositories/git_http_controller.rb index aa6609bef2a..3cf0a23b7f6 100644 --- a/app/controllers/repositories/git_http_controller.rb +++ b/app/controllers/repositories/git_http_controller.rb @@ -80,6 +80,8 @@ module Repositories return if Gitlab::Database.read_only? return unless repo_type.project? + OnboardingProgressService.new(project.namespace).execute(action: :git_read) + if Feature.enabled?(:project_statistics_sync, project, default_enabled: true) Projects::FetchStatisticsIncrementService.new(project).execute else @@ -90,7 +92,6 @@ module Repositories def access @access ||= access_klass.new(access_actor, container, 'http', authentication_abilities: authentication_abilities, - namespace_path: params[:namespace_id], repository_path: repository_path, redirected_path: redirected_path, auth_result_type: auth_result_type) @@ -113,10 +114,6 @@ module Repositories @access_klass ||= repo_type.access_checker_class end - def repository_path - @repository_path ||= params[:repository_id].sub(/\.git$/, '') - end - def log_user_activity Users::ActivityService.new(user).execute end diff --git a/app/controllers/repositories/lfs_api_controller.rb b/app/controllers/repositories/lfs_api_controller.rb index 96185608c09..248323a0bb5 100644 --- a/app/controllers/repositories/lfs_api_controller.rb +++ b/app/controllers/repositories/lfs_api_controller.rb @@ -92,16 +92,26 @@ module Repositories { upload: { href: "#{project.http_url_to_repo}/gitlab-lfs/objects/#{object[:oid]}/#{object[:size]}", - header: { - Authorization: authorization_header, - # git-lfs v2.5.0 sets the Content-Type based on the uploaded file. This - # ensures that Workhorse can intercept the request. - 'Content-Type': LFS_TRANSFER_CONTENT_TYPE - }.compact + header: upload_headers } } end + def upload_headers + headers = { + Authorization: authorization_header, + # git-lfs v2.5.0 sets the Content-Type based on the uploaded file. This + # ensures that Workhorse can intercept the request. + 'Content-Type': LFS_TRANSFER_CONTENT_TYPE + } + + if Feature.enabled?(:lfs_chunked_encoding, project, default_enabled: true) + headers['Transfer-Encoding'] = 'chunked' + end + + headers + end + def lfs_check_batch_operation! if batch_operation_disallowed? render( |