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 | 166 | get "files" |
| 167 | 167 | end |
| 168 | 168 | |
| 169 | + resources :blob, only: [:show], constraints: {id: /.+/} | |
| 169 | 170 | resources :tree, only: [:show, :edit, :update], constraints: {id: /.+/} |
| 170 | 171 | resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} |
| 171 | 172 | resources :commits, only: [:show], constraints: {id: /.+/} |
| 172 | 173 | resources :compare, only: [:index, :create] |
| 173 | 174 | resources :blame, only: [:show], constraints: {id: /.+/} |
| 174 | - resources :blob, only: [:show], constraints: {id: /.+/} | |
| 175 | 175 | resources :graph, only: [:show], constraints: {id: /.+/} |
| 176 | 176 | match "/compare/:from...:to" => "compare#show", as: "compare", |
| 177 | 177 | :via => [:get, :post], constraints: {from: /.+/, to: /.+/} | ... | ... |
spec/routing/project_routing_spec.rb
| ... | ... | @@ -392,6 +392,7 @@ end |
| 392 | 392 | describe BlobController, "routing" do |
| 393 | 393 | it "to #show" do |
| 394 | 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 | 396 | end |
| 396 | 397 | end |
| 397 | 398 | ... | ... |