Commit 26d97ac5 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Send more raw blob data with workhorse

parent 9109619e
...@@ -2,15 +2,14 @@ class Projects::AvatarsController < Projects::ApplicationController ...@@ -2,15 +2,14 @@ class Projects::AvatarsController < Projects::ApplicationController
before_action :project before_action :project
def show 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 if @blob
headers['X-Content-Type-Options'] = 'nosniff' headers['X-Content-Type-Options'] = 'nosniff'
send_data( headers['Gitlab-Workhorse-Repo-Path'] = repository.path_to_repo
@blob.data, headers['Gitlab-Workhorse-Send-Blob'] = @blob.id
type: @blob.mime_type, headers['Content-Disposition'] = 'inline'
disposition: 'inline', render nothing: true, content_type: @blob.content_type
filename: @blob.name
)
else else
render_404 render_404
end end
......
...@@ -18,7 +18,7 @@ class Projects::RawController < Projects::ApplicationController ...@@ -18,7 +18,7 @@ class Projects::RawController < Projects::ApplicationController
send_lfs_object send_lfs_object
else else
headers['Gitlab-Workhorse-Repo-Path'] = @repository.path_to_repo 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' headers['Content-Disposition'] = 'inline'
render nothing: true, content_type: get_blob_type render nothing: true, content_type: get_blob_type
end end
......
...@@ -57,7 +57,8 @@ module API ...@@ -57,7 +57,8 @@ module API
not_found! "File" unless blob not_found! "File" unless blob
content_type 'text/plain' content_type 'text/plain'
present blob.data header 'Gitlab-Workhorse-Repo-Path', repo.path_to_repo
header 'Gitlab-Workhorse-Send-Blob', blob.id
end end
# Get a raw blob contents by blob sha # Get a raw blob contents by blob sha
...@@ -83,7 +84,8 @@ module API ...@@ -83,7 +84,8 @@ module API
env['api.format'] = :txt env['api.format'] = :txt
content_type blob.mime_type 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 end
# Get a an archive of the repository # Get a an archive of the repository
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment