summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-08 21:22:13 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-08 21:22:13 +0300
commitcb20ab0201a0a685bd9340cc9fe4695ba82fc60b (patch)
tree2ffcebd5659261625ad85e9d3b8cb03c6b802123
parent4d11a3d8cd5502ff276c12d69d9ad1c6b8652b0f (diff)
parentda9b009d31ee342d96da7b8796b937849de650cd (diff)
downloadgitlab-ce-cb20ab0201a0a685bd9340cc9fe4695ba82fc60b.tar.gz
Merge pull request #6929 from asedge/fix_api_branches_with_periods
Add fix for API when branch names have periods in them. Relates to issu...
-rw-r--r--lib/api/branches.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index 953c6100f8b..d54f9371fbe 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -24,7 +24,7 @@ module API
# branch (required) - The name of the branch
# Example Request:
# GET /projects/:id/repository/branches/:branch
- get ":id/repository/branches/:branch" do
+ get ':id/repository/branches/:branch', requirements: { branch: /.*/ } do
@branch = user_project.repo.heads.find { |item| item.name == params[:branch] }
not_found!("Branch does not exist") if @branch.nil?
present @branch, with: Entities::RepoObject, project: user_project
@@ -37,7 +37,9 @@ module API
# branch (required) - The name of the branch
# Example Request:
# PUT /projects/:id/repository/branches/:branch/protect
- put ":id/repository/branches/:branch/protect" do
+ put ':id/repository/branches/:branch/protect',
+ requirements: { branch: /.*/ } do
+
authorize_admin_project
@branch = user_project.repository.find_branch(params[:branch])
@@ -55,7 +57,9 @@ module API
# branch (required) - The name of the branch
# Example Request:
# PUT /projects/:id/repository/branches/:branch/unprotect
- put ":id/repository/branches/:branch/unprotect" do
+ put ':id/repository/branches/:branch/unprotect',
+ requirements: { branch: /.*/ } do
+
authorize_admin_project
@branch = user_project.repository.find_branch(params[:branch])