From 35873d4b810a421409b9b0dfc598b5688d5b0b67 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 3 Apr 2026 10:24:54 +0800 Subject: [PATCH] fix comment --- routers/api/packages/api.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/routers/api/packages/api.go b/routers/api/packages/api.go index ade94d6a43..eb8febdb17 100644 --- a/routers/api/packages/api.go +++ b/routers/api/packages/api.go @@ -473,11 +473,12 @@ func CommonRoutes() *web.Router { g.MatchPath("GET", "//repodata/", rpm.GetRepositoryFile) 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. - // 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 + // ~~Order is important here: the more specific long route (with filename) must come first.~~ + // ~~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: the MatchPath has been fixed, the order is not important anymore + // As long as the CI passes, we can remove the comments and the new test case (not needed anymore) g.MatchPath("HEAD,GET", "//package////", rpm.DownloadPackageFile) g.MatchPath("HEAD,GET", "//package///", rpm.DownloadPackageFile) g.MatchPath("DELETE", "//package///", reqPackageAccess(perm.AccessModeWrite), rpm.DeletePackageFile)