Sync issue / packages not found

Problem:
Due to the proxy sync memory issues with the elasticsearch repositories I have switched them to additive mirroring policy, retaining three versions.

I have noticed that I cannot download packages for elastic 7.x (repository URL https://artifacts.elastic.co/packages/7.x/yum) from my foreman content proxy because clients get a ‘404 not found’.

For instance when trying to update metricbeat:

[MIRROR]  metricbeat-7.17.29-1.x86_64.rpm: Status code: 404 for https://foreman8-content.example.com/pulp/content/ORG/Production/alma8-epel8/custom/elastic/elasticsearch-7-x/Packages/m/metricbeat-7.17.29-1.x86_64.rpm

In the repository on the main server the rpm filename is filebeat-7.17.29-x86_64.rpm.

The problem seems to be that in the upstream elastic repository, all packages are release version “1” but the location points to a filename without release version, e.g.

<package type="rpm">
  <name>filebeat</name>
  <arch>x86_64</arch>
  <version epoch="0" ver="7.17.29" rel="1"/>
  <checksum type="sha256" pkgid="YES">c5c29a65b7471f8c13f5c46882c5f20a40c7649f40a870f91d54a7520d5ae269</checksum>
  <summary>Filebeat sends log files to Logstash or directly to Elasticsearch.</summary>
  <description>Filebeat sends log files to Logstash or directly to Elasticsearch.</description>
  <packager>&lt;@e19274952431&gt;</packager>
  <url>https://www.elastic.co/beats/filebeat</url>
  <time file="1750299221" build="1750264623"/>
  <size package="37158206" installed="137188994" archive="137460020"/>
  <location href="7.17.29/filebeat-7.17.29-x86_64.rpm"/>
  <format>
    <rpm:license>Elastic-License</rpm:license>
    <rpm:vendor>Elastic</rpm:vendor>
    <rpm:group>default</rpm:group>
    <rpm:buildhost>e19274952431</rpm:buildhost>
    <rpm:sourcerpm>filebeat-7.17.29-1.src.rpm</rpm:sourcerpm>
    <rpm:header-range start="4504" end="246273"/>
    <rpm:provides>
      <rpm:entry name="filebeat" flags="EQ" epoch="0" ver="7.17.29" rel="1"/>
      <rpm:entry name="filebeat(x86-64)" flags="EQ" epoch="0" ver="7.17.29" rel="1"/>
    </rpm:provides>
    <rpm:requires>
      <rpm:entry name="/bin/sh" pre="1"/>
    </rpm:requires>
  <file>/etc/filebeat/fields.yml</file>
  <file>/etc/filebeat/filebeat.reference.yml</file>
  <file>/etc/filebeat/filebeat.yml</file>
...
  </format>
</package>

Katello syncs the rpm with the original filename filebeat-7.17.29-x86_64.rpm and keeps that name, but puts filebeat-7.17.29-1.x86_64.rpm into the primary.xml instead. This is already inconsistent in the Library view on the main server https://foreman8.example.com/pulp/content/ORG/Library/custom/elastic/elasticsearch-7-x/

Foreman and Proxy versions:
katello-4.18.1-1.el9.noarch
foreman-3.16.2-1.el9.noarch

Distribution and version:
AlmaLinux 9.7

I feel like this kind of path naming inconsistency rings a bell. It might be worth searching if there is already an issue/fix for this on the pulpcore or pulp_rpm side, that has not yet made it into Katello.