Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/7851.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed `RepositoryVersion.remove_content` incorrectly removing all content instead of only the specified lazy content.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really reflect the scenario the remove could fail in. It's when the remove is self-referential and the amount is greater than 65k, correct?

4 changes: 2 additions & 2 deletions pulpcore/app/models/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,13 +1231,13 @@ def remove_content(self, content):
# Undo addition by deleting the RepositoryContent.
RepositoryContent.objects.filter(
repository=self.repository,
content_id__in=content,
content_id__in=to_remove,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when to_remove is greater than 65k? Does this break?

version_added=self,
version_removed=None,
).delete()

q_set = RepositoryContent.objects.filter(
repository=self.repository, content_id__in=content, version_removed=None
repository=self.repository, content_id__in=to_remove, version_removed=None
)
q_set.update(version_removed=self)

Expand Down
Loading