Skip to content

Commit

Permalink
avoid issues related to repos endswith .git
Browse files Browse the repository at this point in the history
  • Loading branch information
jefer94 committed Dec 17, 2024
1 parent b9b5769 commit fe60b05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ def delete_github_repositories(self):
for deletion_order in qs:
ids.append(deletion_order.id)

if deletion_order.repository_name.endswith(".git"):
deletion_order.repository_name = deletion_order.repository_name[:-4]
deletion_order.save()

try:
if self.github_client.repo_exists(
owner=deletion_order.repository_user, repo=deletion_order.repository_name
Expand Down Expand Up @@ -289,6 +293,9 @@ def schedule_github_deletion(self, provider: str, user: str, repo_name: str):
).exists():
return

if repo_name.endswith(".git"):
repo_name = repo_name[:-4]

status = RepositoryDeletionOrder.Status.PENDING
if (
Task.objects.filter(github_url__icontains=f"github.com/{user}/{repo_name}")
Expand Down Expand Up @@ -356,6 +363,10 @@ def transfer_ownership(self):
for deletion_order in qs:
ids.append(deletion_order.id)

if deletion_order.repository_name.endswith(".git"):
deletion_order.repository_name = deletion_order.repository_name[:-4]
deletion_order.save()

try:
if self.github_client.repo_exists(
owner=deletion_order.repository_user, repo=deletion_order.repository_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def github(self):
if deletion_order.repository_user not in allowed_users:
continue

if deletion_order.repository_name.endswith(".git"):
deletion_order.repository_name = deletion_order.repository_name[:-4]
deletion_order.save()

new_owner = self.get_username(deletion_order.repository_user, deletion_order.repository_name)
if new_owner is None:
continue
Expand Down

0 comments on commit fe60b05

Please sign in to comment.