Commit 9f2041ad0edd2919d9d1a41e0426b4fa4294bfe5
Exists in
master
and in
4 other branches
Merge pull request #2965 from yurifury/fix-blob-route
Gitlab incorrectly routes blobs to the compare controller depending on filename.
Showing
2 changed files
with
2 additions
and
1 deletions
Show diff stats
config/routes.rb
@@ -166,12 +166,12 @@ Gitlab::Application.routes.draw do | @@ -166,12 +166,12 @@ Gitlab::Application.routes.draw do | ||
166 | get "files" | 166 | get "files" |
167 | end | 167 | end |
168 | 168 | ||
169 | + resources :blob, only: [:show], constraints: {id: /.+/} | ||
169 | resources :tree, only: [:show, :edit, :update], constraints: {id: /.+/} | 170 | resources :tree, only: [:show, :edit, :update], constraints: {id: /.+/} |
170 | resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} | 171 | resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} |
171 | resources :commits, only: [:show], constraints: {id: /.+/} | 172 | resources :commits, only: [:show], constraints: {id: /.+/} |
172 | resources :compare, only: [:index, :create] | 173 | resources :compare, only: [:index, :create] |
173 | resources :blame, only: [:show], constraints: {id: /.+/} | 174 | resources :blame, only: [:show], constraints: {id: /.+/} |
174 | - resources :blob, only: [:show], constraints: {id: /.+/} | ||
175 | resources :graph, only: [:show], constraints: {id: /.+/} | 175 | resources :graph, only: [:show], constraints: {id: /.+/} |
176 | match "/compare/:from...:to" => "compare#show", as: "compare", | 176 | match "/compare/:from...:to" => "compare#show", as: "compare", |
177 | :via => [:get, :post], constraints: {from: /.+/, to: /.+/} | 177 | :via => [:get, :post], constraints: {from: /.+/, to: /.+/} |
spec/routing/project_routing_spec.rb
@@ -392,6 +392,7 @@ end | @@ -392,6 +392,7 @@ end | ||
392 | describe BlobController, "routing" do | 392 | describe BlobController, "routing" do |
393 | it "to #show" do | 393 | it "to #show" do |
394 | get("/gitlabhq/blob/master/app/models/project.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') | 394 | get("/gitlabhq/blob/master/app/models/project.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') |
395 | + get("/gitlabhq/blob/master/app/models/compare.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/compare.rb') | ||
395 | end | 396 | end |
396 | end | 397 | end |
397 | 398 |