Problem
FileContentFilter in pulp_file/app/viewsets.py only supports exact matching on the relative_path field:
class Meta:
model = FileContent
fields = ["relative_path", "sha256"]
This means API consumers cannot filter file content by path patterns — there is no support for contains, startswith, regex, or other lookup expressions on relative_path.
Other content filters in pulpcore already use NAME_FILTER_OPTIONS for name/path fields (e.g., ContentFilter), so FileContentFilter is inconsistent with the rest of the API.
Proposed fix
Use NAME_FILTER_OPTIONS for relative_path to enable the full set of lookup expressions:
from pulpcore.app.viewsets.base import NAME_FILTER_OPTIONS
class Meta:
model = FileContent
fields = {
"relative_path": NAME_FILTER_OPTIONS,
"digest": ["exact"],
}
This enables: exact, iexact, in, contains, icontains, startswith, istartswith, regex, iregex.
The existing sha256 = CharFilter(field_name="digest") alias on the filter class continues to provide backwards-compatible ?sha256= query parameter support.
Use case
Deployments managing large file repositories need to search for content by path prefix (e.g., all files under packages/python/) or by pattern (e.g., all .rpm files). Currently this requires fetching all file content and filtering client-side.
Problem
FileContentFilterinpulp_file/app/viewsets.pyonly supports exact matching on therelative_pathfield:This means API consumers cannot filter file content by path patterns — there is no support for
contains,startswith,regex, or other lookup expressions onrelative_path.Other content filters in pulpcore already use
NAME_FILTER_OPTIONSfor name/path fields (e.g.,ContentFilter), soFileContentFilteris inconsistent with the rest of the API.Proposed fix
Use
NAME_FILTER_OPTIONSforrelative_pathto enable the full set of lookup expressions:This enables:
exact,iexact,in,contains,icontains,startswith,istartswith,regex,iregex.The existing
sha256 = CharFilter(field_name="digest")alias on the filter class continues to provide backwards-compatible?sha256=query parameter support.Use case
Deployments managing large file repositories need to search for content by path prefix (e.g., all files under
packages/python/) or by pattern (e.g., all.rpmfiles). Currently this requires fetching all file content and filtering client-side.