Merge pull request #2965 from yurifury/fix-blob-route
Gitlab incorrectly routes blobs to the compare controller depending on filename.
This commit is contained in:
commit
9f2041ad0e
|
@ -166,12 +166,12 @@ Gitlab::Application.routes.draw do
|
||||||
get "files"
|
get "files"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :blob, only: [:show], constraints: {id: /.+/}
|
||||||
resources :tree, only: [:show, :edit, :update], constraints: {id: /.+/}
|
resources :tree, only: [:show, :edit, :update], constraints: {id: /.+/}
|
||||||
resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
|
resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
|
||||||
resources :commits, only: [:show], constraints: {id: /.+/}
|
resources :commits, only: [:show], constraints: {id: /.+/}
|
||||||
resources :compare, only: [:index, :create]
|
resources :compare, only: [:index, :create]
|
||||||
resources :blame, only: [:show], constraints: {id: /.+/}
|
resources :blame, only: [:show], constraints: {id: /.+/}
|
||||||
resources :blob, only: [:show], constraints: {id: /.+/}
|
|
||||||
resources :graph, only: [:show], constraints: {id: /.+/}
|
resources :graph, only: [:show], constraints: {id: /.+/}
|
||||||
match "/compare/:from...:to" => "compare#show", as: "compare",
|
match "/compare/:from...:to" => "compare#show", as: "compare",
|
||||||
:via => [:get, :post], constraints: {from: /.+/, to: /.+/}
|
:via => [:get, :post], constraints: {from: /.+/, to: /.+/}
|
||||||
|
|
|
@ -392,6 +392,7 @@ end
|
||||||
describe BlobController, "routing" do
|
describe BlobController, "routing" do
|
||||||
it "to #show" do
|
it "to #show" do
|
||||||
get("/gitlabhq/blob/master/app/models/project.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
|
get("/gitlabhq/blob/master/app/models/project.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
|
||||||
|
get("/gitlabhq/blob/master/app/models/compare.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/compare.rb')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue