fix:上传同名文件时删除旧版本

This commit is contained in:
weisd
2024-08-15 17:37:58 +08:00
parent 11c3c093c8
commit de09015154

View File

@@ -159,6 +159,7 @@ impl LocalDisk {
debug!("delete_file ranme to trash {:?} to {:?}", &delete_path, &trash_path);
// TODO: 清空回收站
if let Err(err) = fs::rename(&delete_path, &trash_path).await {
match err.kind() {
ErrorKind::NotFound => (),
@@ -169,6 +170,9 @@ impl LocalDisk {
}
}
// FIXME: 先清空回收站吧,有时间再添加判断逻辑
let _ = fs::remove_dir_all(&trash_path).await;
// TODO: immediate
} else {
if delete_path.is_dir() {