added file checker, completation/size/digest

This commit is contained in:
2026-03-30 13:20:13 +02:00
parent 8afe71d925
commit f5227bcac9
8 changed files with 291 additions and 43 deletions
+38
View File
@@ -254,6 +254,44 @@ func (hand *Handler) ListFiles(rctx *router.Context) {
rctx.SendJSON(code, res.Files)
}
func (hand *Handler) CheckFiles(rctx *router.Context) {
filepath, _ := rctx.GetSubpath("path")
if filepath == "" {
filepath = "/"
}
params := &fileoper.CheckFilesParams{
Path: filepath,
}
err := rctx.BindQuery(params)
if err != nil {
hand.logg.Errorf("CheckFiles binding error: %v", err)
rctx.SetStatus(http.StatusInternalServerError)
return
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteFiles, params.Path)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
}
if !opEnable {
rctx.SetStatus(http.StatusMethodNotAllowed)
return
}
// Execution of the operation
ctx := rctx.GetContext()
code, res, err := hand.fiop.CheckFiles(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("CheckFiles error: %v", err)
rctx.SetStatus(code)
return
}
rctx.SendJSON(code, res.Files)
}
// GetProperty godoc
//
// @Summary List collections