diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-08-02 19:26:35 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-08-02 19:26:35 +0000 |
commit | f4cb04da7625f437be9477805f3be4c329eae6df (patch) | |
tree | 281a17e3142a77f039e000e1213ec634f4516749 /config | |
parent | 90c277aa3cd55322d1bfe68ce8e9dd38c1a5c347 (diff) | |
parent | e1832914df2eccea1730586b26e759b562e8b7c1 (diff) | |
download | gitlab-ce-f4cb04da7625f437be9477805f3be4c329eae6df.tar.gz |
Merge branch 'branches-ending-with-json' into 'master'
Allow branch names ending with .json for graph and network page
## What does this MR do?
Allow branch names to end with `.json` for graph and network page.
## Why was this MR needed?
Displaying branches ending on `.json` in repository view crashes because links to graph and network page can not be determined.
## What are the relevant issue numbers?
fixes #20462, #19585
See merge request !5579
Diffstat (limited to 'config')
-rw-r--r-- | config/routes.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/config/routes.rb b/config/routes.rb index 371eb4bee7f..2f5f32d9e30 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -626,13 +626,17 @@ Rails.application.routes.draw do get '/compare/:from...:to', to: 'compare#show', as: 'compare', constraints: { from: /.+/, to: /.+/ } - resources :network, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } - - resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do - member do - get :commits - get :ci - get :languages + # Don't use format parameter as file extension (old 3.0.x behavior) + # See http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments + scope format: false do + resources :network, only: [:show], constraints: { id: Gitlab::Regex.git_reference_regex } + + resources :graphs, only: [:show], constraints: { id: Gitlab::Regex.git_reference_regex } do + member do + get :commits + get :ci + get :languages + end end end |