Skip to content

Commit 994326f

Browse files
Sebastian-T-TGiteaBot
authored andcommitted
Add standard-compliant route to serve outdated R packages (go-gitea#32783)
The R package repository currently does not have support for older versions of packages which should be stored in a separate /Archive router. This PR remedies that by adding a new path router. I am a member of a group that loves using Gitea and this bug has been annoying us for a long time. Hope it can be merged in time for Gitea 1.23.0. Any feedback much appreciated. Fixes go-gitea#32782
1 parent 0c7e44f commit 994326f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

routers/api/packages/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ func CommonRoutes() *web.Route {
314314
r.Get("/PACKAGES", cran.EnumerateSourcePackages)
315315
r.Get("/PACKAGES{format}", cran.EnumerateSourcePackages)
316316
r.Get("/{filename}", cran.DownloadSourcePackageFile)
317+
r.Get("/Archive/{packagename}/{filename}", cran.DownloadSourcePackageFile)
317318
})
318319
r.Put("", reqPackageAccess(perm.AccessModeWrite), cran.UploadSourcePackageFile)
319320
})

tests/integration/api_packages_cran_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ func TestPackageCran(t *testing.T) {
115115
MakeRequest(t, req, http.StatusOK)
116116
})
117117

118+
t.Run("DownloadArchived", func(t *testing.T) {
119+
defer tests.PrintCurrentTest(t)()
120+
121+
req := NewRequest(t, "GET", fmt.Sprintf("%s/src/contrib/Archive/%s/%s_%s.tar.gz", url, packageName, packageName, packageVersion)).
122+
AddBasicAuth(user.Name)
123+
MakeRequest(t, req, http.StatusOK)
124+
})
125+
118126
t.Run("Enumerate", func(t *testing.T) {
119127
defer tests.PrintCurrentTest(t)()
120128

0 commit comments

Comments
 (0)