Commit da9b009d31ee342d96da7b8796b937849de650cd
Committed by
Sean
1 parent
536b2f2f
Exists in
spb-stable
and in
2 other branches
Add fix for API when branch names have periods in them. Relates to issue #6128 …
…(https://github.com/gitlabhq/gitlabhq/issues/6128).
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
lib/api/branches.rb
... | ... | @@ -24,7 +24,7 @@ module API |
24 | 24 | # branch (required) - The name of the branch |
25 | 25 | # Example Request: |
26 | 26 | # GET /projects/:id/repository/branches/:branch |
27 | - get ":id/repository/branches/:branch" do | |
27 | + get ':id/repository/branches/:branch', requirements: { branch: /.*/ } do | |
28 | 28 | @branch = user_project.repo.heads.find { |item| item.name == params[:branch] } |
29 | 29 | not_found!("Branch does not exist") if @branch.nil? |
30 | 30 | present @branch, with: Entities::RepoObject, project: user_project |
... | ... | @@ -37,7 +37,9 @@ module API |
37 | 37 | # branch (required) - The name of the branch |
38 | 38 | # Example Request: |
39 | 39 | # PUT /projects/:id/repository/branches/:branch/protect |
40 | - put ":id/repository/branches/:branch/protect" do | |
40 | + put ':id/repository/branches/:branch/protect', | |
41 | + requirements: { branch: /.*/ } do | |
42 | + | |
41 | 43 | authorize_admin_project |
42 | 44 | |
43 | 45 | @branch = user_project.repository.find_branch(params[:branch]) |
... | ... | @@ -55,7 +57,9 @@ module API |
55 | 57 | # branch (required) - The name of the branch |
56 | 58 | # Example Request: |
57 | 59 | # PUT /projects/:id/repository/branches/:branch/unprotect |
58 | - put ":id/repository/branches/:branch/unprotect" do | |
60 | + put ':id/repository/branches/:branch/unprotect', | |
61 | + requirements: { branch: /.*/ } do | |
62 | + | |
59 | 63 | authorize_admin_project |
60 | 64 | |
61 | 65 | @branch = user_project.repository.find_branch(params[:branch]) | ... | ... |