MCPcopy
hub / github.com/IceWhaleTech/CasaOS / GetLocalFile

Function GetLocalFile

route/v1/file.go:119–134  ·  view source on GitHub ↗
(ctx echo.Context)

Source from the content-addressed store, hash-verified

117}
118
119func GetLocalFile(ctx echo.Context) error {
120 path := ctx.QueryParam("path")
121 if len(path) == 0 {
122 return ctx.JSON(http.StatusOK, model.Result{
123 Success: common_err.INVALID_PARAMS,
124 Message: common_err.GetMsg(common_err.INVALID_PARAMS),
125 })
126 }
127 if !file.Exists(path) {
128 return ctx.JSON(http.StatusOK, model.Result{
129 Success: common_err.FILE_DOES_NOT_EXIST,
130 Message: common_err.GetMsg(common_err.FILE_DOES_NOT_EXIST),
131 })
132 }
133 return ctx.File(path)
134}
135
136// @Summary download
137// @Produce application/json

Callers

nothing calls this directly

Calls 2

GetMsgFunction · 0.92
ExistsFunction · 0.92

Tested by

no test coverage detected