Commit 9ae26cd128122936adf07e03aeecb221b5a72ecf

Authored by Dmitriy Zaporozhets
2 parents 09572e40 c830bab7

Merge pull request #4257 from jojosch/fix/routing-commit-with-#

Routing fix Commit-List: branch with # and + in name
config/routes.rb
@@ -251,11 +251,11 @@ Gitlab::Application.routes.draw do @@ -251,11 +251,11 @@ Gitlab::Application.routes.draw do
251 251
252 member do 252 member do
253 # tree viewer logs 253 # tree viewer logs
254 - get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } 254 + get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ }
255 get "logs_tree/:path" => "refs#logs_tree", 255 get "logs_tree/:path" => "refs#logs_tree",
256 as: :logs_file, 256 as: :logs_file,
257 constraints: { 257 constraints: {
258 - id: /[a-zA-Z.0-9\/_\-]+/, 258 + id: /[a-zA-Z.0-9\/_\-#%+]+/,
259 path: /.*/ 259 path: /.*/
260 } 260 }
261 end 261 end
spec/routing/project_routing_spec.rb
@@ -201,7 +201,11 @@ describe RefsController, "routing" do @@ -201,7 +201,11 @@ describe RefsController, "routing" do
201 201
202 it "to #logs_tree" do 202 it "to #logs_tree" do
203 get("/gitlabhq/refs/stable/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable') 203 get("/gitlabhq/refs/stable/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable')
  204 + get("/gitlabhq/refs/feature%2345/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45')
  205 + get("/gitlabhq/refs/feature%2B45/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45')
204 get("/gitlabhq/refs/stable/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') 206 get("/gitlabhq/refs/stable/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz')
  207 + get("/gitlabhq/refs/feature%2345/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45', path: 'foo/bar/baz')
  208 + get("/gitlabhq/refs/feature%2B45/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45', path: 'foo/bar/baz')
205 get("/gitlab/gitlabhq/refs/stable/logs_tree/files.scss").should route_to('refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'stable', path: 'files.scss') 209 get("/gitlab/gitlabhq/refs/stable/logs_tree/files.scss").should route_to('refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'stable', path: 'files.scss')
206 end 210 end
207 end 211 end