Gitea import does not import all issues
Summary
During the import of Gitea repositories into GitLab some issues may be skipped over due to query string parameters changing during API pagination requests.
Steps to reproduce
Import a Gitea repository containing more than 10 issues, some of which are closed. This results in not all issues being imported.
What is the current bug behavior?
When an import from a Gitea repository is kicked off it attempts to import all the issues. The first query to the Gitea API is correct in that it sends a requests like:
/api/v1/repos/{owner}/{repo}/issues?direction=asc&page=1&per_page=100&sort=created&state=all
However, subsequent pagination requests to the API don't include the query string parameters included in the first request. ie:
/api/v1/repos/{owner}/{repo}/issues?page=2
/api/v1/repos/{owner}/{repo}/issues?page=3
While the Gitea API ignores the direction
, per_page
and sort
query parameters anyway, the missing state=all
parameter causes Gitea to only return the default "open" issues. This causes all closed issues not returned by the first request to not be imported, as well any open issues that get lost because they weren't included in the initial request because that request included closed issues.
What is the expected correct behavior?
All Gitea issues imported correctly with none being lost.
Possible fixes
As best as I could track down, it seems to be an issues somewhere within the call to increment_page(resource_type) which appears to follow a different code path to initial requests made by client.public_send(resource_type, *opts)
Given that the problem is in the fetch_resources(resource_type, *opts) method, this issues may affect the importing of other resource types as well.