fix(backend): stop Gitea/Forgejo pagination on empty page response#1130
fix(backend): stop Gitea/Forgejo pagination on empty page response#1130brendan-kellam merged 2 commits intomainfrom
Conversation
When an API token can only see a subset of org repos, the x-total-count header reports the org total while the token returns fewer items. The previous loop condition (output.length < totalCount) would never be satisfied for the visible subset, causing infinite pagination. Now we break out of the loop when the API returns an empty page, matching the Gitea API pagination docs recommendation. Fixes #1108 Co-authored-by: Brendan Kellam <brendan-kellam@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
|
@claude add a changelog entry |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis fix addresses an infinite pagination loop in Gitea/Forgejo API calls when an API token lacks visibility to all organization repositories. The pagination now breaks early when an empty page is received, preventing unlimited requests regardless of the reported total count. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude finished @brendan-kellam's task in 39s —— View job Changelog Entry Added
Added the following entry to
|
Co-authored-by: Brendan Kellam <brendan-kellam@users.noreply.github.com>
When an API token can only see a subset of org repos, the
x-total-countheader reports the org total while the token returns fewer items. The previous loop condition (output.length < totalCount) would never be satisfied for the visible subset, causing infinite pagination and effectively DoS-ing the Gitea/Forgejo instance.The fix breaks out of the loop when the API returns an empty page, matching the Gitea API pagination docs recommendation.
Fixes #1108
Generated with Claude Code
Summary by CodeRabbit