Skip to content

Don't allow negative values for pagination

What does this MR do and why?

Problem

GitLab API does not support negaative values for pagination and result can be unexpected.

Solution

Return 400 error if negative value is provided to the pagination.

Screenshots or screen recordings

http://127.0.0.1:3000/api/v4/projects/1/repository/commits?page=-1

Before After
Screenshot_2022-07-29_at_17.10.25 Screenshot_2022-07-29_at_17.10.05

How to set up and validate locally

  1. Enable feature flag Feature.enable(:only_positive_pagination_values)
  2. Visit http://127.0.0.1:3000/api/v4/projects/1/repository/commits?page=-1

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports