modrinth / labrinth

Our Rust-based backend utilizing the actix-web framework to serve Modrinth's API.
https://modrinth.com
GNU Affero General Public License v3.0
509 stars 73 forks source link

`GET /v2/search` - If the offset parameter is less than the limit parameter, it is ignored #906

Open Zechiax opened 2 months ago

Zechiax commented 2 months ago

Describe the bug

If the offset is less than the limit parameter, e.g. limit is 10 and offset is 1, the results returned are not offset but remain the same as if the offset were 0, unless the offset is >= than limit.

Steps to reproduce

The results are the same unless offset it >= than the limit

  1. Offset not applied - Search with offset 1, limit 4
  2. Offset not applied - Search with offset 2, limit 4
  3. Offset not applied - Search with offset 3, limit 4
  4. Offset applied - Search with offset 4, limit 4

Expected behavior

The offset should be applied even if it is less than the limit parameter.

Additional context

As it it mostly used for paging, where the offset is usually equal to the limit, it's not much of a problem.