diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-06-10 10:31:20 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-06-10 10:31:20 +0530 |
commit | d754d99179f1ffe846fcc1d8e858163b39efc5dc (patch) | |
tree | 1359c07166aa7a71038e17fbd4b2c788c6ab66da /config/routes.rb | |
parent | e18a08fd89f59088db22208069370a85f6a33001 (diff) | |
parent | cea3cf177c68bb1fa9326d4e88631b7737ae8a98 (diff) | |
download | gitlab-ce-d754d99179f1ffe846fcc1d8e858163b39efc5dc.tar.gz |
Merge remote-tracking branch 'origin/master' into 2979-personal-access-tokens
Diffstat (limited to 'config/routes.rb')
-rw-r--r-- | config/routes.rb | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/config/routes.rb b/config/routes.rb index f2be5d502b5..25373d2a81d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -449,22 +449,6 @@ Rails.application.routes.draw do resources(:projects, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, except: [:new, :create, :index], path: "/") do - # Allow /info/refs, /info/refs?service=git-upload-pack, and - # /info/refs?service=git-receive-pack, but nothing else. - # - git_http_handshake = lambda do |request| - request.query_string.blank? || - request.query_string.match(/\Aservice=git-(upload|receive)-pack\z/) - end - - ref_redirect = redirect do |params, request| - path = "#{params[:namespace_id]}/#{params[:project_id]}.git/info/refs" - path << "?#{request.query_string}" unless request.query_string.blank? - path - end - - get '/info/refs', constraints: git_http_handshake, to: ref_redirect - member do put :transfer delete :remove_fork @@ -479,12 +463,28 @@ Rails.application.routes.draw do scope module: :projects do # Git HTTP clients ('git clone' etc.) - scope constraints: { format: /(git|wiki\.git)/ } do + scope constraints: { id: /.+\.git/, format: nil } do 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' end + # Allow /info/refs, /info/refs?service=git-upload-pack, and + # /info/refs?service=git-receive-pack, but nothing else. + # + git_http_handshake = lambda do |request| + request.query_string.blank? || + request.query_string.match(/\Aservice=git-(upload|receive)-pack\z/) + end + + ref_redirect = redirect do |params, request| + path = "#{params[:namespace_id]}/#{params[:project_id]}.git/info/refs" + path << "?#{request.query_string}" unless request.query_string.blank? + path + end + + get '/info/refs', constraints: git_http_handshake, to: ref_redirect + # Blob routes: get '/new/*id', to: 'blob#new', constraints: { id: /.+/ }, as: 'new_blob' post '/create/*id', to: 'blob#create', constraints: { id: /.+/ }, as: 'create_blob' |