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
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
......
......@@ -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
......
......@@ -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
......
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