diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2016-07-20 19:41:26 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2016-07-22 18:54:04 +0300 |
commit | 0d9752446d8e2b3b4fdb37eb8ec75c5e5f996f1c (patch) | |
tree | e164e0781a8e8bf2076503c504dacff670136554 /config | |
parent | 033e5423a2594e08a7ebcd2379bd2331f4c39032 (diff) |
Add LFS controllers
Diffstat (limited to 'config')
-rw-r--r-- | config/routes.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/config/routes.rb b/config/routes.rb index 21f3585bacd..47599441cad 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -85,9 +85,6 @@ Rails.application.routes.draw do # Health check get 'health_check(/:checks)' => 'health_check#index', as: :health_check - # Enable Grack support (for LFS only) - mount Grack::AuthSpawner, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\/(info\/lfs|gitlab-lfs)/.match(request.path_info) }, via: [:get, :post, :put] - # Help get 'help' => 'help#index' get 'help/shortcuts' => 'help#shortcuts' @@ -483,11 +480,26 @@ Rails.application.routes.draw do end scope module: :projects do - # Git HTTP clients ('git clone' etc.) scope constraints: { id: /.+\.git/, format: nil } do + # Git HTTP clients ('git clone' etc.) get '/info/refs', to: 'git_http#info_refs' post '/git-upload-pack', to: 'git_http#git_upload_pack' post '/git-receive-pack', to: 'git_http#git_receive_pack' + + # Git LFS API (metadata) + post '/info/lfs/objects/batch', to: 'lfs_api#batch' + post '/info/lfs/objects', to: 'lfs_api#deprecated' + get '/info/lfs/objects/*oid', to: 'lfs_api#deprecated' + + # GitLab LFS object storage + scope constraints: { oid: /[a-f0-9]{64}/ } do + get '/gitlab-lfs/objects/*oid', to: 'lfs_storage#download' + + scope constraints: { size: /[0-9]+/ } do + put '/gitlab-lfs/objects/*oid/*size/authorize', to: 'lfs_storage#upload_authorize' + put '/gitlab-lfs/objects/*oid/*size', to: 'lfs_storage#upload_finalize' + end + end end # Allow /info/refs, /info/refs?service=git-upload-pack, and |