diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2015-11-21 18:08:45 +0100 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2015-11-21 18:08:45 +0100 |
commit | faef95af1a07bdcfd02eead36d144f332b428f1f (patch) | |
tree | 7f34f351e7681036bbafda1980e1d403316ee7d5 /lib | |
parent | 2cba93a0d2d12ee36bf98569e5c6c14ac7ea40e0 (diff) | |
download | gitlab-ce-faef95af1a07bdcfd02eead36d144f332b428f1f.tar.gz |
API: Return 404 if the tag for a release does not exist
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/tags.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/api/tags.rb b/lib/api/tags.rb index 2c6c73da08e..0721b9cc844 100644 --- a/lib/api/tags.rb +++ b/lib/api/tags.rb @@ -51,10 +51,14 @@ module API put ':id/repository/tags/:tag_name/release', requirements: { tag_name: /.*/ } do authorize_push_project required_attributes! [:description] - release = user_project.releases.find_or_initialize_by(tag: params[:tag_name]) - release.update_attributes(description: params[:description]) + result = CreateReleaseService.new(user_project, current_user). + execute(params[:tag_name], params[:description]) - present release, with: Entities::Release + if result[:status] == :success + present result[:release], with: Entities::Release + else + render_api_error!(result[:message], 404) + end end end end |