diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-01-28 18:04:46 +0100 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-01-28 18:04:46 +0100 |
commit | 26d97ac5e19c242594b59d224a77d41d0f1de6e1 (patch) | |
tree | a3b9fab50b744b3480b9db242538484ebb76b834 | |
parent | 9109619ee6fe85ee7e8ebfa51c6587319b523930 (diff) | |
download | gitlab-ce-26d97ac5e19c242594b59d224a77d41d0f1de6e1.tar.gz |
Send more raw blob data with workhorse
-rw-r--r-- | app/controllers/projects/avatars_controller.rb | 13 | ||||
-rw-r--r-- | app/controllers/projects/raw_controller.rb | 2 | ||||
-rw-r--r-- | lib/api/repositories.rb | 6 |
3 files changed, 11 insertions, 10 deletions
diff --git a/app/controllers/projects/avatars_controller.rb b/app/controllers/projects/avatars_controller.rb index 548f1b9ebfe..0cd65ad5b16 100644 --- a/app/controllers/projects/avatars_controller.rb +++ b/app/controllers/projects/avatars_controller.rb @@ -2,15 +2,14 @@ class Projects::AvatarsController < Projects::ApplicationController before_action :project def show - @blob = @project.repository.blob_at_branch('master', @project.avatar_in_git) + repository = @project.repository + @blob = repository.blob_at_branch('master', @project.avatar_in_git) if @blob headers['X-Content-Type-Options'] = 'nosniff' - send_data( - @blob.data, - type: @blob.mime_type, - disposition: 'inline', - filename: @blob.name - ) + headers['Gitlab-Workhorse-Repo-Path'] = repository.path_to_repo + headers['Gitlab-Workhorse-Send-Blob'] = @blob.id + headers['Content-Disposition'] = 'inline' + render nothing: true, content_type: @blob.content_type else render_404 end diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb index e55cdea94ae..b3c846bc3c3 100644 --- a/app/controllers/projects/raw_controller.rb +++ b/app/controllers/projects/raw_controller.rb @@ -18,7 +18,7 @@ class Projects::RawController < Projects::ApplicationController send_lfs_object else headers['Gitlab-Workhorse-Repo-Path'] = @repository.path_to_repo - headers['Gitlab-Workhorse-Send-Blob'] = Base64.urlsafe_encode64(@commit.id + ':' + @path) + headers['Gitlab-Workhorse-Send-Blob'] = @blob.id headers['Content-Disposition'] = 'inline' render nothing: true, content_type: get_blob_type end diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index d7c48639eba..0f4cd2443b0 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -57,7 +57,8 @@ module API not_found! "File" unless blob content_type 'text/plain' - present blob.data + header 'Gitlab-Workhorse-Repo-Path', repo.path_to_repo + header 'Gitlab-Workhorse-Send-Blob', blob.id end # Get a raw blob contents by blob sha @@ -83,7 +84,8 @@ module API env['api.format'] = :txt content_type blob.mime_type - present blob.data + header 'Gitlab-Workhorse-Repo-Path', repo.path_to_repo + header 'Gitlab-Workhorse-Send-Blob', blob.id end # Get a an archive of the repository |