Commit 9ae26cd128122936adf07e03aeecb221b5a72ecf
Exists in
master
and in
4 other branches
Merge pull request #4257 from jojosch/fix/routing-commit-with-#
Routing fix Commit-List: branch with # and + in name
Showing
2 changed files
with
6 additions
and
2 deletions
Show diff stats
config/routes.rb
| ... | ... | @@ -251,11 +251,11 @@ Gitlab::Application.routes.draw do |
| 251 | 251 | |
| 252 | 252 | member do |
| 253 | 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 | 255 | get "logs_tree/:path" => "refs#logs_tree", |
| 256 | 256 | as: :logs_file, |
| 257 | 257 | constraints: { |
| 258 | - id: /[a-zA-Z.0-9\/_\-]+/, | |
| 258 | + id: /[a-zA-Z.0-9\/_\-#%+]+/, | |
| 259 | 259 | path: /.*/ |
| 260 | 260 | } |
| 261 | 261 | end | ... | ... |
spec/routing/project_routing_spec.rb
| ... | ... | @@ -201,7 +201,11 @@ describe RefsController, "routing" do |
| 201 | 201 | |
| 202 | 202 | it "to #logs_tree" do |
| 203 | 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 | 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 | 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 | 210 | end |
| 207 | 211 | end | ... | ... |