Step to reproduce:
- Log into your Gogs account on https://try.gogs.io/
- Visit https://try.gogs.io/api/v1/repos/search?page=1. The API will reply adequately and you'll get 10 repos.
- But, visit https://try.gogs.io/api/v1/repos/search?page=17. It won't be accessible and return 500 but the next page will be accessible. More importantly, we rely on the Link header of the response for deciding the next page url which is also missing in such cases.
Expected behavior:
https://try.gogs.io/api/v1/repos/search?page=17 should also return 200 and the relevant repos.
After some experiments with the page size, I discovered that exactly the repo at position 162 is the culprit i.e. only https://try.gogs.io/api/v1/repos/search?page=162&limit=1 returns 500 error. There's something wrong with this repo and the server isn't able to handle it.
Upstream issue link: https://github.com/gogs/gogs/issues/7124