diff options
| author | Armin Hohenegger <armin695@gmail.com> | 2019-08-10 19:11:20 +0200 |
|---|---|---|
| committer | Armin Hohenegger <armin695@gmail.com> | 2019-08-10 19:11:20 +0200 |
| commit | 20ac5e6d4b1e1b6807e13b11daaedd2fb47bd3fc (patch) | |
| tree | 3e1fc3a651668becaa3961c6ad98f97b7b57d676 /lib/api | |
| parent | ea671dec7f9db06c1d45ddd1536c1af194de8f62 (diff) | |
| download | gitlab-ce-20ac5e6d4b1e1b6807e13b11daaedd2fb47bd3fc.tar.gz | |
fix handling of empty ref_name parameter string in commits api
when params[:ref_name] is set to "" by passing an empty query parameter
to the api it is evaluated as false by the || operator.
The use of active support core extensions presence method fixes the original
implemantation.
https://guides.rubyonrails.org/active_support_core_extensions.html#presence
Diffstat (limited to 'lib/api')
| -rw-r--r-- | lib/api/commits.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index e4f4e79cd46..a2f3e87ebd2 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -43,7 +43,7 @@ module API path = params[:path] before = params[:until] after = params[:since] - ref = params[:ref_name] || user_project.try(:default_branch) || 'master' unless params[:all] + ref = params[:ref_name].presence || user_project.try(:default_branch) || 'master' unless params[:all] offset = (params[:page] - 1) * params[:per_page] all = params[:all] with_stats = params[:with_stats] |
