Skip to content
Snippets Groups Projects
Commit 85a461e0 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Check if commit exists first in commit status API

parent 8c66d739
No related branches found
No related tags found
1 merge request!3010Return empty array when commit has no statuses in API
Pipeline #
Loading
@@ -20,8 +20,8 @@ module API
Loading
@@ -20,8 +20,8 @@ module API
get ':id/repository/commits/:sha/statuses' do get ':id/repository/commits/:sha/statuses' do
authorize!(:read_commit_status, user_project) authorize!(:read_commit_status, user_project)
   
ci_commit = user_project.ci_commit(params[:sha])
not_found!('Commit') unless user_project.commit(params[:sha]) not_found!('Commit') unless user_project.commit(params[:sha])
ci_commit = user_project.ci_commit(params[:sha])
return [] unless ci_commit return [] unless ci_commit
   
statuses = ci_commit.statuses statuses = ci_commit.statuses
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment