Skip to content

Commit ef9d1e9

Browse files
Add standard-compliant route to serve outdated R packages (#32783) (#32789)
Backport #32783 by Sebastian-T-T 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. Fixes #32782 Co-authored-by: Sebastian T. T. <[email protected]>
1 parent 0c7e44f commit ef9d1e9

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)