mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-01-13 02:24:25 +08:00
fix: Fixed issue where deleting symbolic link files fails (#11373)
Refs https://github.com/1Panel-dev/1Panel/issues/11324
This commit is contained in:
parent
2546809013
commit
2ad882b7c2
1 changed files with 5 additions and 1 deletions
|
|
@ -172,7 +172,6 @@ func shouldFilterPath(path string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// 递归构建文件树(只取当前目录以及当前目录下的第一层子节点)
|
||||
func (f *FileService) buildFileTree(node *response.FileTree, items []*files.FileInfo, op request.FileOption, level int) error {
|
||||
for _, v := range items {
|
||||
if shouldFilterPath(v.Path) {
|
||||
|
|
@ -272,6 +271,11 @@ func (f *FileService) Delete(op request.FileDelete) error {
|
|||
return fo.DeleteFile(op.Path)
|
||||
}
|
||||
}
|
||||
info, _ := fo.Fs.Stat(op.Path)
|
||||
if info == nil || files.IsSymlink(info.Mode()) {
|
||||
return os.Remove(op.Path)
|
||||
}
|
||||
|
||||
if err := NewIRecycleBinService().Create(request.RecycleBinCreate{SourcePath: op.Path}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue