diff --git a/CHANGES/5559.feature b/CHANGES/5559.feature new file mode 100644 index 00000000..6befc8f3 --- /dev/null +++ b/CHANGES/5559.feature @@ -0,0 +1 @@ +Add checking for path overlapping for RepositoryVersions and Publications. diff --git a/pulp_file/app/models.py b/pulp_file/app/models.py index 075774ed..09f32c85 100644 --- a/pulp_file/app/models.py +++ b/pulp_file/app/models.py @@ -10,7 +10,8 @@ Remote, Repository, ) -from pulpcore.plugin.repo_version_utils import remove_duplicates +from pulpcore.plugin.publication_utils import validate_publication_paths +from pulpcore.plugin.repo_version_utils import remove_duplicates, validate_version_paths log = getLogger(__name__) @@ -51,7 +52,10 @@ class Meta: def finalize_new_version(self, new_version): """ - Ensure no added content contains the same `relative_path` as other content. + Finalize and validate the new repository version. + + Ensure no added content contains the same `relative_path` as other content and relative + paths don't overlap. Args: new_version (pulpcore.app.models.RepositoryVersion): The incomplete RepositoryVersion to @@ -59,6 +63,7 @@ def finalize_new_version(self, new_version): """ remove_duplicates(new_version) + validate_version_paths(new_version) class FileRemote(Remote): @@ -82,6 +87,12 @@ class FilePublication(Publication): class Meta: default_related_name = "%(app_label)s_%(model_name)s" + def finalize_new_publication(self): + """ + Validate that artifact paths don't overlap. + """ + validate_publication_paths(self) + class FileDistribution(PublicationDistribution): """