Skip to content

Commit

Permalink
feat: add an EMPTY ecosystem for withdrawn records (#2705)
Browse files Browse the repository at this point in the history
Some records will be withdrawn from upstream and may also have their
affected package information deleted. These records currently cannot be
exported and may cause confusion for our customers due to missing
records. Adding an "EMPTY" ecosystem will represent these records for
exporting.
  • Loading branch information
hogo6002 authored Oct 10, 2024
1 parent a69e860 commit ccb7c0e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions osv/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,11 @@ def _pre_put_hook(self): # pylint: disable=arguments-differ
if 'GIT' in ecosystems_set:
break

# If a withdrawn record has no affected package,
# assign an '[EMPTY]' ecosystem value for export.
if not ecosystems_set:
ecosystems_set.add('[EMPTY]')

# For all ecosystems that specify a specific version with colon,
# also add the base name
ecosystems_set.update({ecosystems.normalize(x) for x in ecosystems_set})
Expand Down

0 comments on commit ccb7c0e

Please sign in to comment.