diff options
author | Rémy Coutable <remy@rymai.me> | 2016-07-01 18:25:23 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-07-01 18:25:23 +0300 |
commit | 984698dc968828495d6a1680231775924b0979d4 (patch) | |
tree | 4a8751a2e42c768d4001f9710f7b5020523c0af5 /lib | |
parent | 6c0d3b4cf3847b78b89170ccb0d8a1e5ebdc48d6 (diff) | |
parent | cc324eb4ab6f10386dccd891f6b3fdd14b91d2e6 (diff) |
Merge branch 'refactor-tags-branches-api' into 'master'
Ensure that branch and tag names are given in API
## What does this MR do?
It ensures that the tag or branch name is given. @rymai We talked in an earlier MR about this.
See merge request !5012
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/branches.rb | 8 | ||||
-rw-r--r-- | lib/api/tags.rb | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb index 231840148d9..9f9ae75ff65 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -25,7 +25,7 @@ module API # branch (required) - The name of the branch # Example Request: # GET /projects/:id/repository/branches/:branch - get ':id/repository/branches/:branch', requirements: { branch: /.*/ } do + get ':id/repository/branches/:branch', requirements: { branch: /.+/ } do @branch = user_project.repository.branches.find { |item| item.name == params[:branch] } not_found!("Branch") unless @branch present @branch, with: Entities::RepoObject, project: user_project @@ -39,7 +39,7 @@ module API # Example Request: # PUT /projects/:id/repository/branches/:branch/protect put ':id/repository/branches/:branch/protect', - requirements: { branch: /.*/ } do + requirements: { branch: /.+/ } do authorize_admin_project @@ -59,7 +59,7 @@ module API # Example Request: # PUT /projects/:id/repository/branches/:branch/unprotect put ':id/repository/branches/:branch/unprotect', - requirements: { branch: /.*/ } do + requirements: { branch: /.+/ } do authorize_admin_project @@ -101,7 +101,7 @@ module API # Example Request: # DELETE /projects/:id/repository/branches/:branch delete ":id/repository/branches/:branch", - requirements: { branch: /.*/ } do + requirements: { branch: /.+/ } do authorize_push_project result = DeleteBranchService.new(user_project, current_user). execute(params[:branch]) diff --git a/lib/api/tags.rb b/lib/api/tags.rb index 3e1ed3fe5c7..7b675e05fbb 100644 --- a/lib/api/tags.rb +++ b/lib/api/tags.rb @@ -61,7 +61,7 @@ module API # tag_name (required) - The name of the tag # Example Request: # DELETE /projects/:id/repository/tags/:tag - delete ":id/repository/tags/:tag_name", requirements: { tag_name: /.*/ } do + delete ":id/repository/tags/:tag_name", requirements: { tag_name: /.+/ } do authorize_push_project result = DeleteTagService.new(user_project, current_user). execute(params[:tag_name]) @@ -83,7 +83,7 @@ module API # description (required) - Release notes with markdown support # Example Request: # POST /projects/:id/repository/tags/:tag_name/release - post ':id/repository/tags/:tag_name/release', requirements: { tag_name: /.*/ } do + post ':id/repository/tags/:tag_name/release', requirements: { tag_name: /.+/ } do authorize_push_project required_attributes! [:description] result = CreateReleaseService.new(user_project, current_user). @@ -104,7 +104,7 @@ module API # description (required) - Release notes with markdown support # Example Request: # PUT /projects/:id/repository/tags/:tag_name/release - put ':id/repository/tags/:tag_name/release', requirements: { tag_name: /.*/ } do + put ':id/repository/tags/:tag_name/release', requirements: { tag_name: /.+/ } do authorize_push_project required_attributes! [:description] result = UpdateReleaseService.new(user_project, current_user). |