Skip to content

Commit 1377b65

Browse files
committed
clarify
1 parent 108ac13 commit 1377b65

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

routers/api/packages/api.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,9 @@ func CommonRoutes() *web.Router {
467467
g.MatchPath("HEAD", "/<group:*>/repodata/<filename>", rpm.CheckRepositoryFileExistence)
468468
g.MatchPath("GET", "/<group:*>/repodata/<filename>", rpm.GetRepositoryFile)
469469
g.MatchPath("PUT", "/<group:*>/upload", reqPackageAccess(perm.AccessModeWrite), rpm.UploadPackageFile)
470-
// this URL pattern is only used internally in the RPM index, it is generated by us
471-
g.MatchPath("HEAD,GET", "/<group:*>/package/<name>/<version>/<architecture>/<*>", rpm.DownloadPackageFile)
470+
// 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)
471+
g.MatchPath("HEAD,GET", "/<group:*>/package/<name>/<version>/<architecture>", rpm.DownloadPackageFile)
472+
g.MatchPath("HEAD,GET", "/<group:*>/package/<name>/<version>/<architecture>/<filename>", rpm.DownloadPackageFile)
472473
g.MatchPath("DELETE", "/<group:*>/package/<name>/<version>/<architecture>", reqPackageAccess(perm.AccessModeWrite), rpm.DeletePackageFile)
473474
}, reqPackageAccess(perm.AccessModeRead))
474475

tests/integration/api_packages_rpm_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,14 @@ gpgkey=%sapi/packages/%s/rpm/repository.key`,
157157
t.Run("Download", func(t *testing.T) {
158158
defer tests.PrintCurrentTest(t)()
159159

160-
rpmFileName := fmt.Sprintf("%s-%s.%s.rpm", packageName, packageVersion, packageArchitecture)
161-
req := NewRequest(t, "GET", fmt.Sprintf("%s/package/%s/%s/%s/%s", groupURL, packageName, packageVersion, packageArchitecture, rpmFileName))
160+
// download the package without the file name
161+
req := NewRequest(t, "GET", fmt.Sprintf("%s/package/%s/%s/%s", groupURL, packageName, packageVersion, packageArchitecture))
162162
resp := MakeRequest(t, req, http.StatusOK)
163+
assert.Equal(t, content, resp.Body.Bytes())
163164

165+
// download the package with a file name (it can be anything)
166+
req = NewRequest(t, "GET", fmt.Sprintf("%s/package/%s/%s/%s/any-file-name", groupURL, packageName, packageVersion, packageArchitecture))
167+
resp = MakeRequest(t, req, http.StatusOK)
164168
assert.Equal(t, content, resp.Body.Bytes())
165169
})
166170

0 commit comments

Comments
 (0)