mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-22 20:36:38 +00:00
fix:上传同名文件时删除旧版本
This commit is contained in:
@@ -159,6 +159,7 @@ impl LocalDisk {
|
|||||||
|
|
||||||
debug!("delete_file ranme to trash {:?} to {:?}", &delete_path, &trash_path);
|
debug!("delete_file ranme to trash {:?} to {:?}", &delete_path, &trash_path);
|
||||||
|
|
||||||
|
// TODO: 清空回收站
|
||||||
if let Err(err) = fs::rename(&delete_path, &trash_path).await {
|
if let Err(err) = fs::rename(&delete_path, &trash_path).await {
|
||||||
match err.kind() {
|
match err.kind() {
|
||||||
ErrorKind::NotFound => (),
|
ErrorKind::NotFound => (),
|
||||||
@@ -169,6 +170,9 @@ impl LocalDisk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: 先清空回收站吧,有时间再添加判断逻辑
|
||||||
|
let _ = fs::remove_dir_all(&trash_path).await;
|
||||||
|
|
||||||
// TODO: immediate
|
// TODO: immediate
|
||||||
} else {
|
} else {
|
||||||
if delete_path.is_dir() {
|
if delete_path.is_dir() {
|
||||||
|
|||||||
Reference in New Issue
Block a user