feat: 解决删除文件报错的问题 (#3171)

Refs https://github.com/1Panel-dev/1Panel/issues/3020
This commit is contained in:
zhengkunwang 2023-12-04 18:06:09 +08:00 committed by GitHub
parent 0a761e9e79
commit c47c8b0f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,7 @@ func (r RecycleBinService) Create(create request.RecycleBinCreate) error {
} }
rName := fmt.Sprintf("_1p_%s%s_p_%d_%d", "file", rNamePre, size, deleteTime.Unix()) rName := fmt.Sprintf("_1p_%s%s_p_%d_%d", "file", rNamePre, size, deleteTime.Unix())
return op.Rename(create.SourcePath, path.Join(clashDir, rName)) return op.Mv(create.SourcePath, path.Join(clashDir, rName))
} }
func (r RecycleBinService) Reduce(reduce request.RecycleBinReduce) error { func (r RecycleBinService) Reduce(reduce request.RecycleBinReduce) error {
@ -125,7 +125,7 @@ func (r RecycleBinService) Reduce(reduce request.RecycleBinReduce) error {
return err return err
} }
} }
return op.Rename(filePath, recycleBinDTO.SourcePath) return op.Mv(filePath, recycleBinDTO.SourcePath)
} }
func (r RecycleBinService) Clear() error { func (r RecycleBinService) Clear() error {
@ -140,7 +140,7 @@ func (r RecycleBinService) Clear() error {
continue continue
} }
newDir := path.Join(p.Mountpoint, "1panel_clash") newDir := path.Join(p.Mountpoint, "1panel_clash")
if err := op.Rename(dir, newDir); err != nil { if err := op.Mv(dir, newDir); err != nil {
return err return err
} }
go func() { go func() {