Description
Description
When uploading a file with a name like hello-test-0.0.1^15.git7166d1f2-1.el9.x86_64.rpm
to the RPM registry, I am able to see the file correctly in the Gitea packages UI and can manually download the RPM from there, but DNF cannot download it on an actual system. DNF does see that the package exists and tries to download it, but gets 404 errors:
Downloading Packages:
[MIRROR] hello-test-0.0.1%5E15.git7166d1f2-1.el9.x86_64.rpm: Status code: 404 for https://example.com/api/packages/testuser/rpm/almalinux/el9/package/hello-test/0.0.1%255E15.git7166d1f2-1.el9/x86_64/hello-test-0.0.1%255E15.git7166d1f2-1.el9.x86_64.rpm (IP: 136.56.234.199)
[MIRROR] hello-test-0.0.1%5E15.git7166d1f2-1.el9.x86_64.rpm: Status code: 404 for https://example.com/api/packages/testuser/rpm/almalinux/el9/package/hello-test/0.0.1%255E15.git7166d1f2-1.el9/x86_64/hello-test-0.0.1%255E15.git7166d1f2-1.el9.x86_64.rpm (IP: 136.56.234.199)
[FAILED] hello-test-0.0.1%5E15.git7166d1f2-1.el9.x86_64.rpm: No more mirrors to try - All mirrors were already tried without success
In my gitea logs, I can see those 404 attempts.
172.17.0.1 - - [10/Sep/2024:09:40:55 -0400] "GET /api/packages/testuser/rpm/almalinux/el9/repodata/repomd.xml HTTP/1.0" 200 1244 "" "libdnf (AlmaLinux 9.4; generic; Linux.x86_64)"
172.17.0.1 - - [10/Sep/2024:09:40:57 -0400] "GET /api/packages/testuser/rpm/almalinux/el9/package/hello-test/0.0.1%255E15.git7166d1f2-1.el9/x86_64/hello-test-0.0.1%255E15.git7166d1f2-1.el9.x86_64.rpm HTTP/1.0" 404 22 "" "libdnf (AlmaLinux 9.4; generic; Linux.x86_64)"
172.17.0.1 - - [10/Sep/2024:09:40:57 -0400] "GET /api/packages/testuser/rpm/almalinux/el9/package/hello-test/0.0.1%255E15.git7166d1f2-1.el9/x86_64/hello-test-0.0.1%255E15.git7166d1f2-1.el9.x86_64.rpm HTTP/1.0" 404 22 "" "libdnf (AlmaLinux 9.4; generic; Linux.x86_64)"
If I try to put one of those URLs into my web browser like https://example.com/api/packages/testuser/rpm/almalinux/el9/package/hello-test/0.0.1%255E15.git7166d1f2-1.el9/x86_64/hello-test-0.0.1%255E15.git7166d1f2-1.el9.x86_64.rpm
, I indeed get a message package does not exist
.
If, however, I change those instances of %255E
in the URL to %5E
, the URL does work so it seems the caret is being url encoded twice. Looking in the repodata/primary.xml.gz
that gitea produces, I see that the location
field it produces has the caret already encoded to %5E
, but in major RPM repositories like EPEL (https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/repodata/) this is not the case and the location
does not have carets already url encoded. In my own testing producing a version of the gitea repository files that does not have the caret pre-urlencoded in the field works and allows packages to be downloaded by the package manager and seems to match the behaviour of other RPM repositories.
I have reproduced the issue on the demo site here: https://demo.gitea.com/nephatrine/-/packages/rpm/hello-test/0.0.1%5E15.git7166d1f2-1.el9
Gitea Version
1.22.2
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
2.45.2
Operating System
Alpine 3.20
How are you running Gitea?
I build Gitea myself and run it from my own docker container.
Database
SQLite