0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-07 11:25:23 +02:00

Fix RPM Registry 404 when package name contains 'package'

Swap the order of overlapping routes in api.go to prevent the short route from intercepting long paths when the name contains 'package'.

Fixes #37086

Signed-off-by: Rohan Guliani <rohansguliani@google.com>
This commit is contained in:
Rohan Guliani 2026-04-02 18:44:32 +00:00
parent 2158cf6e12
commit 86215d5212

View File

@ -473,8 +473,8 @@ func CommonRoutes() *web.Router {
g.MatchPath("GET", "/<group:*>/repodata/<filename>", rpm.GetRepositoryFile)
g.MatchPath("PUT", "/<group:*>/upload", reqPackageAccess(perm.AccessModeWrite), rpm.UploadPackageFile)
// this URL pattern is only used internally in the RPM index, it is generated by us, the filename part is not really used (can be anything)
g.MatchPath("HEAD,GET", "/<group:*>/package/<name>/<version>/<architecture>", rpm.DownloadPackageFile)
g.MatchPath("HEAD,GET", "/<group:*>/package/<name>/<version>/<architecture>/<filename>", rpm.DownloadPackageFile)
g.MatchPath("HEAD,GET", "/<group:*>/package/<name>/<version>/<architecture>", rpm.DownloadPackageFile)
g.MatchPath("DELETE", "/<group:*>/package/<name>/<version>/<architecture>", reqPackageAccess(perm.AccessModeWrite), rpm.DeletePackageFile)
}, reqPackageAccess(perm.AccessModeRead))