diff options
author | Nick Thomas <nick@gitlab.com> | 2018-04-03 18:57:55 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-04-19 17:25:01 +0100 |
commit | 672733aa66e371edc50f6d1c2467896c40ed9ac8 (patch) | |
tree | f7d5313ab03c496c74ca63a29f786d9db19f79b1 /lib/api/helpers/project_snapshots_helpers.rb | |
parent | fb46dfb235f452333984891af5bb677f90faf174 (diff) | |
download | gitlab-ce-672733aa66e371edc50f6d1c2467896c40ed9ac8.tar.gz |
Add an API endpoint to download git repository snapshots
Diffstat (limited to 'lib/api/helpers/project_snapshots_helpers.rb')
-rw-r--r-- | lib/api/helpers/project_snapshots_helpers.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/api/helpers/project_snapshots_helpers.rb b/lib/api/helpers/project_snapshots_helpers.rb new file mode 100644 index 00000000000..94798a8cb51 --- /dev/null +++ b/lib/api/helpers/project_snapshots_helpers.rb @@ -0,0 +1,25 @@ +module API + module Helpers + module ProjectSnapshotsHelpers + def authorize_read_git_snapshot! + authenticated_with_full_private_access! + end + + def send_git_snapshot(repository) + header(*Gitlab::Workhorse.send_git_snapshot(repository)) + end + + def snapshot_project + user_project + end + + def snapshot_repository + if to_boolean(params[:wiki]) + snapshot_project.wiki.repository + else + snapshot_project.repository + end + end + end + end +end |