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

Function PostCreateFile

route/v1/file.go:430–445  ·  view source on GitHub ↗

@Summary create file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path body string true "path of folder (path need to url encode)" @Success 200 {string} string "ok" @Router /file/create [post]

(ctx echo.Context)

Source from the content-addressed store, hash-verified

428// @Success 200 {string} string "ok"
429// @Router /file/create [post]
430func PostCreateFile(ctx echo.Context) error {
431 json := make(map[string]string)
432 ctx.Bind(&json)
433 path := json["path"]
434 var code int
435 if len(path) == 0 {
436 return ctx.JSON(common_err.CLIENT_ERROR, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
437 }
438 // decodedPath, err := url.QueryUnescape(path)
439 // if err != nil {
440 // return ctx.JSON(http.StatusOK, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
441 // return
442 // }
443 code, _ = service.MyService.System().CreateFile(path)
444 return ctx.JSON(common_err.SUCCESS, model.Result{Success: code, Message: common_err.GetMsg(code)})
445}
446
447// @Summary upload file
448// @Produce application/json

Callers

nothing calls this directly

Calls 3

GetMsgFunction · 0.92
CreateFileMethod · 0.65
SystemMethod · 0.65

Tested by

no test coverage detected