fix: 删除目录校验 (#7035)

This commit is contained in:
2024-11-13 22:12:01 +08:00 committed by GitHub
parent ec372dbb98
commit 4c01b1e542
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -213,7 +213,7 @@ func (f *FileService) Create(op request.FileCreate) error {
func (f *FileService) Delete(op request.FileDelete) error { func (f *FileService) Delete(op request.FileDelete) error {
if op.IsDir { if op.IsDir {
excludeDir := global.CONF.System.DataDir excludeDir := global.CONF.System.DataDir
if strings.Contains(op.Path, ".1panel_clash") || op.Path == excludeDir { if filepath.Base(op.Path) == ".1panel_clash" || op.Path == excludeDir {
return buserr.New(constant.ErrPathNotDelete) return buserr.New(constant.ErrPathNotDelete)
} }
} }