Skip to content

Commit 894267c

Browse files
committed
fix: Handle case sensitive usernames and updates
Before this the GitHub usernames had to be written in a case sensitive manner otherwise a 500 would occur when trying to add the maintainer. This also blocked ingestion of packages when a maintainer change GitHub account (thus GitHub ID) but kept using the same username.
1 parent 1e585ec commit 894267c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/webview/views.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,13 @@ def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse:
577577
# Try to fetch maintainer info from GitHub API and create if found
578578
gh_user = fetch_user_info(new_maintainer_github_handle)
579579
if gh_user:
580-
maintainer = NixMaintainer.objects.create(
580+
maintainer, created = NixMaintainer.objects.update_or_create(
581581
github_id=gh_user["id"],
582-
github=gh_user["login"],
583-
name=gh_user.get("name"),
584-
email=gh_user.get("email"),
582+
defaults={
583+
"github": gh_user["login"],
584+
"name": gh_user.get("name"),
585+
"email": gh_user.get("email"),
586+
},
585587
)
586588
else:
587589
return self.render_to_response(

0 commit comments

Comments
 (0)