MCPcopy Index your code
hub / github.com/aptly-dev/aptly / reposServeInAPIMode

Function reposServeInAPIMode

api/repos.go:53–70  ·  view source on GitHub ↗

@Summary Serve Packages @Description If ServeInAPIMode is enabled in aptly config, @Description this api serves a specified package from storage @Tags Repos @Param storage path string true "Storage" @Param pkgPath path string true "Package Path" allowReserved=true @Produce json @Success 200 "" @Rout

(c *gin.Context)

Source from the content-addressed store, hash-verified

51// @Success 200 ""
52// @Router /repos/{storage}/{pkgPath} [get]
53func reposServeInAPIMode(c *gin.Context) {
54 pkgpath := c.Param("pkgPath")
55
56 storage := c.Param("storage")
57 if storage == "-" {
58 storage = ""
59 } else {
60 storage = "filesystem:" + storage
61 }
62
63 ps, err := context.GetPublishedStorage(storage)
64 if err != nil {
65 AbortWithJSONError(c, http.StatusNotFound, err)
66 return
67 }
68 publicPath := ps.(aptly.FileSystemPublishedStorage).PublicPath()
69 c.FileFromFS(pkgpath, http.Dir(publicPath))
70}
71
72// @Summary List Repositories
73// @Description **Get list of available repos**

Callers

nothing calls this directly

Calls 3

AbortWithJSONErrorFunction · 0.85
GetPublishedStorageMethod · 0.65
PublicPathMethod · 0.65

Tested by

no test coverage detected