gitlab-org--gitlab-foss/app/helpers/workhorse_helper.rb
Douwe Maan 284ed39e30 Merge branch 'send-entry-via-Gitlab-Workhorse-Send-Data' into 'master'
Use Gitlab-Workhorse-Send-Data to send entry

## What does this MR do?

Use Gitlab-Workhorse-Send-Data to send entry:

Closes #19224, Closes #19128

Also requires this MR to work:
https://gitlab.com/gitlab-org/gitlab-workhorse/merge_requests/53

## Are there points in the code the reviewer needs to double check?

Do we have a test for this?

## Why was this MR needed?

This way gitlab-workhorse does not have to call any API.

See merge request !5094
2016-07-11 16:18:37 +00:00

37 lines
1.3 KiB
Ruby

# Helpers to send Git blobs, diffs, patches or archives through Workhorse.
# Workhorse will also serve files when using `send_file`.
module WorkhorseHelper
# Send a Git blob through Workhorse
def send_git_blob(repository, blob)
headers.store(*Gitlab::Workhorse.send_git_blob(repository, blob))
headers['Content-Disposition'] = 'inline'
headers['Content-Type'] = safe_content_type(blob)
head :ok # 'render nothing: true' messes up the Content-Type
end
# Send a Git diff through Workhorse
def send_git_diff(repository, diff_refs)
headers.store(*Gitlab::Workhorse.send_git_diff(repository, diff_refs))
headers['Content-Disposition'] = 'inline'
head :ok
end
# Send a Git patch through Workhorse
def send_git_patch(repository, diff_refs)
headers.store(*Gitlab::Workhorse.send_git_patch(repository, diff_refs))
headers['Content-Disposition'] = 'inline'
head :ok
end
# Archive a Git repository and send it through Workhorse
def send_git_archive(repository, ref:, format:)
headers.store(*Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format))
head :ok
end
# Send an entry from artifacts through Workhorse
def send_artifacts_entry(build, entry)
headers.store(*Gitlab::Workhorse.send_artifacts_entry(build, entry))
head :ok
end
end