Send more raw blob data with workhorse
This commit is contained in:
parent
9109619ee6
commit
26d97ac5e1
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue