Skip to content

Commit 2ad882b

Browse files
fix: Fixed issue where deleting symbolic link files fails (#11373)
Refs #11324
1 parent 2546809 commit 2ad882b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

agent/app/service/file.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ func shouldFilterPath(path string) bool {
172172
return false
173173
}
174174

175-
// 递归构建文件树(只取当前目录以及当前目录下的第一层子节点)
176175
func (f *FileService) buildFileTree(node *response.FileTree, items []*files.FileInfo, op request.FileOption, level int) error {
177176
for _, v := range items {
178177
if shouldFilterPath(v.Path) {
@@ -272,6 +271,11 @@ func (f *FileService) Delete(op request.FileDelete) error {
272271
return fo.DeleteFile(op.Path)
273272
}
274273
}
274+
info, _ := fo.Fs.Stat(op.Path)
275+
if info == nil || files.IsSymlink(info.Mode()) {
276+
return os.Remove(op.Path)
277+
}
278+
275279
if err := NewIRecycleBinService().Create(request.RecycleBinCreate{SourcePath: op.Path}); err != nil {
276280
return err
277281
}

0 commit comments

Comments
 (0)