Updata:增加限制删除

This commit is contained in:
jiaji.H 2026-01-06 09:23:16 +08:00
parent 83e9d8266d
commit 057e8e5d15

View File

@ -4,6 +4,7 @@ import (
"bytes"
"context"
"errors"
"fmt"
"fonchain-fiee/api/files"
"fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/bundle/common"
@ -102,6 +103,15 @@ func Create(ctx *gin.Context) {
}
func Delete(ctx *gin.Context) {
path := ctx.DefaultQuery("path", "/")
nowYear := time.Now().Year()
nowMonth := time.Now().Month()
nowYearPath := fmt.Sprintf("/fiee/video/%d", nowYear)
nowMonthPath := fmt.Sprintf("/fiee/video/%d/%d", nowYear, nowMonth)
if path == nowYearPath || path == nowMonthPath || path == "/fiee" || path == "/fiee/video" {
service.Error(ctx, errors.New("无法删除该目录"))
return
}
resp, err := service.FilesProvider.Delete(ctx, &files.DeleteReq{
Path: ctx.DefaultQuery("path", "/"),
UserSpacePath: getUserSpacePath(ctx),