From 94af7e2adc66713869e8c0f016bb8966afe5a782 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 3 Apr 2026 09:52:14 +0800 Subject: [PATCH] fix comment --- routers/api/packages/api.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routers/api/packages/api.go b/routers/api/packages/api.go index 65fe7636b7..ade94d6a43 100644 --- a/routers/api/packages/api.go +++ b/routers/api/packages/api.go @@ -474,8 +474,10 @@ func CommonRoutes() *web.Router { g.MatchPath("PUT", "//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) // Order is important here: the more specific long route (with filename) must come first. - // If the short route is first, it can greedily match the filename as part of the architecture - // when the package name itself contains the string "package". + // Otherwise, when a package name contains "package", + // * request path: ".../rpm/package/gitea-package/1.0.2-1/x86_64/any-file-name" + // * it also matches "/rpm//package///", + // * TODO: because the generated regexp `^/(.*?)/?package/([^/]+)/([^/]+)/([^/]+)$` is not right for this case g.MatchPath("HEAD,GET", "//package////", rpm.DownloadPackageFile) g.MatchPath("HEAD,GET", "//package///", rpm.DownloadPackageFile) g.MatchPath("DELETE", "//package///", reqPackageAccess(perm.AccessModeWrite), rpm.DeletePackageFile)