summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwinniehell <git@winniehell.de>2016-07-31 22:52:44 +0200
committerwinniehell <git@winniehell.de>2016-08-02 03:32:28 +0200
commite1832914df2eccea1730586b26e759b562e8b7c1 (patch)
tree12832bec15c046c9bd6593c5c1202e9b63bfd6a4
parent010477edc034330dfe4bce7b4dfac252e1fb0a25 (diff)
downloadgitlab-ce-e1832914df2eccea1730586b26e759b562e8b7c1.tar.gz
Allow branch names ending with .json for graph and network page (!5579)
-rw-r--r--CHANGELOG1
-rw-r--r--app/views/projects/graphs/show.html.haml2
-rw-r--r--config/routes.rb18
3 files changed, 13 insertions, 8 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 4daf9cd9092..6bd6f40975f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -34,6 +34,7 @@ v 8.11.0 (unreleased)
- Gitlab::Metrics.current_transaction needs to be public for RailsQueueDuration
- Fix search for notes which belongs to deleted objects
- Add GitLab Workhorse version to admin dashboard (Katarzyna Kobierska Ula Budziszewska)
+ - Allow branch names ending with .json for graph and network page !5579 (winniehell)
- Add the `sprockets-es6` gem
- Multiple trigger variables show in separate lines (Katarzyna Kobierska Ula Budziszewska)
- Profile requests when a header is passed
diff --git a/app/views/projects/graphs/show.html.haml b/app/views/projects/graphs/show.html.haml
index 8777e0d8fcd..ac5f792d140 100644
--- a/app/views/projects/graphs/show.html.haml
+++ b/app/views/projects/graphs/show.html.haml
@@ -32,7 +32,7 @@
:javascript
$.ajax({
type: "GET",
- url: "#{namespace_project_graph_path(@project.namespace, @project, current_ref, :json)}",
+ url: "#{namespace_project_graph_path(@project.namespace, @project, current_ref, format: :json)}",
dataType: "json",
success: function (data) {
var graph = new ContributorsStatGraph();
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