Skip to content

Commit

Permalink
Fix a flaw that allowing duplicate advisories in repo version
Browse files Browse the repository at this point in the history
Closes #3587

(cherry picked from commit b7a9e20)
  • Loading branch information
hao-yu authored and ggainey committed Jun 17, 2024
1 parent 68d2f09 commit ef813e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/3587.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a flaw that still allowed to add duplicate advisories to a repository version.
5 changes: 5 additions & 0 deletions pulp_rpm/app/advisory.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ def resolve_advisories(version, previous_version):
if pk_to_add:
new_advisory = UpdateRecord.objects.filter(pk=pk_to_add[0]).get()
tmp_advisories.append(new_advisory)
# If the first duplicate advisory is ended up in to_remove or to_exclude then
# set the one it was compared against as the one to keep.
# See https://github.com/pulp/pulp_rpm/pull/3588
elif new_advisory.pk in pk_to_remove or new_advisory.pk in pk_to_exclude:
new_advisory = adv
content_pks_to_exclude.update(pk_to_exclude)
content_pks_to_remove.update(pk_to_remove)
added_advisories_by_id[adv_id] = [new_advisory]
Expand Down

0 comments on commit ef813e4

Please sign in to comment.