Skip to content

Commit

Permalink
Exclude the package we are looking at
Browse files Browse the repository at this point in the history
Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Nov 3, 2023
1 parent 43db297 commit 5ece198
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packagedb/management/commands/update_maven_download_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def handle(self, *args, **options):
qualifiers=package_url.qualifiers,
)
generated_download_url = urls['repository_download_url']
if Package.objects.filter(download_url=generated_download_url).exists():
if Package.objects.filter(download_url=generated_download_url).exclude(pk=package.pk).exists():
# This download url already exists in the database, we should just remove this record.
packages_to_delete.append(package)
logger.info(f'Deleting {package.package_uid} - already exists in database')
Expand All @@ -263,7 +263,7 @@ def handle(self, *args, **options):
and package.name.lower() == artifact.name.lower()
and package.version.lower() == artifact.version.lower()
):
if Package.objects.filter(download_url=artifact.download_url).exists():
if Package.objects.filter(download_url=artifact.download_url).exclude(pk=package.pk).exists():
packages_to_delete.append(package)
logger.info(f'Deleting {package.package_uid} - already exists in database')
else:
Expand Down

0 comments on commit 5ece198

Please sign in to comment.