Add standard-compliant route to serve outdated R packages (#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 #32782
This commit is contained in:
parent
4814f43af7
commit
874b8484aa
@ -358,6 +358,7 @@ func CommonRoutes() *web.Router {
|
|||||||
r.Get("/PACKAGES", cran.EnumerateSourcePackages)
|
r.Get("/PACKAGES", cran.EnumerateSourcePackages)
|
||||||
r.Get("/PACKAGES{format}", cran.EnumerateSourcePackages)
|
r.Get("/PACKAGES{format}", cran.EnumerateSourcePackages)
|
||||||
r.Get("/{filename}", cran.DownloadSourcePackageFile)
|
r.Get("/{filename}", cran.DownloadSourcePackageFile)
|
||||||
|
r.Get("/Archive/{packagename}/{filename}", cran.DownloadSourcePackageFile)
|
||||||
})
|
})
|
||||||
r.Put("", reqPackageAccess(perm.AccessModeWrite), cran.UploadSourcePackageFile)
|
r.Put("", reqPackageAccess(perm.AccessModeWrite), cran.UploadSourcePackageFile)
|
||||||
})
|
})
|
||||||
|
@ -115,6 +115,14 @@ func TestPackageCran(t *testing.T) {
|
|||||||
MakeRequest(t, req, http.StatusOK)
|
MakeRequest(t, req, http.StatusOK)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("DownloadArchived", func(t *testing.T) {
|
||||||
|
defer tests.PrintCurrentTest(t)()
|
||||||
|
|
||||||
|
req := NewRequest(t, "GET", fmt.Sprintf("%s/src/contrib/Archive/%s/%s_%s.tar.gz", url, packageName, packageName, packageVersion)).
|
||||||
|
AddBasicAuth(user.Name)
|
||||||
|
MakeRequest(t, req, http.StatusOK)
|
||||||
|
})
|
||||||
|
|
||||||
t.Run("Enumerate", func(t *testing.T) {
|
t.Run("Enumerate", func(t *testing.T) {
|
||||||
defer tests.PrintCurrentTest(t)()
|
defer tests.PrintCurrentTest(t)()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user