fix: case-sensitive username filtering causing silent backup failures #456
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #198 - Fix case-sensitive username filtering
GitHub's API accepts usernames in any case (e.g.,
prai-org,PRAI-Org,PrAi-OrG) but always returns the canonical case in the response. When you type a username with different casing than GitHub's canonical form, the tool's case-sensitive string comparison causes all repositories to be filtered out.How to reproduce:
The tool calls
/user/reposwhich returns all repos the authenticated user has access to. GitHub accepts any case in the command line argument but returns the canonical case in the response:As the filer compares "Iamrodos" == "iamrodos" the result is false.
The bug:
At
github_backup/github_backup.py:1590, the code does exact string matching:Since GitHub's API is not case-sensitive for usernames, the tool's filter shouldn't be either.
History:
This bug was introduced in commit d362adb (January 2016) when the tool switched from
/users/{user}/reposto/user/reposfor private repository access. The/user/reposendpoint returns all repos the authenticated user can see (including organization repos), requiring filtering by owner. The filter comparison was inadvertently made case-sensitive.Fix:
Changed the comparison to be case-insensitive:
Tested with multiple repos using lowercase, uppercase, and mixed case usernames.