diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2014-07-27 21:56:33 +0400 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2014-09-03 15:08:36 +0400 |
commit | 392113919adc75ba1537d89a0de8d0641e24d5b8 (patch) | |
tree | 79c4e5a802592024b3d6621afe4c052bea77ad4e /lib/api/repositories.rb | |
parent | 551145bc98e257280b615e305d531a44d7aa4131 (diff) |
Validate tag-names and references in WebUI, API
Diffstat (limited to 'lib/api/repositories.rb')
-rw-r--r-- | lib/api/repositories.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 42068bb343d..a3773d2c593 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -36,10 +36,15 @@ module API # POST /projects/:id/repository/tags post ':id/repository/tags' do authorize_push_project - @tag = CreateTagService.new.execute(user_project, params[:tag_name], - params[:ref], current_user) - - present @tag, with: Entities::RepoObject, project: user_project + result = CreateTagService.new.execute(user_project, params[:tag_name], + params[:ref], current_user) + if result[:status] == :success + present result[:tag], + with: Entities::RepoObject, + project: user_project + else + render_api_error!(result[:message], 400) + end end # Get a project repository tree |