fix: 清空重置、全量刷新时跳过空路径的删除,微调前端样式 (#679)
This commit is contained in:
@@ -413,11 +413,17 @@ pub async fn full_sync_video_source(
|
||||
let warnings = if request.delete_local {
|
||||
let tasks = video_paths
|
||||
.into_iter()
|
||||
.map(|path| async move {
|
||||
tokio::fs::remove_dir_all(&path)
|
||||
.await
|
||||
.with_context(|| format!("failed to remove {path}"))?;
|
||||
Result::<_, anyhow::Error>::Ok(())
|
||||
.filter_map(|path| {
|
||||
if path.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(async move {
|
||||
tokio::fs::remove_dir_all(&path)
|
||||
.await
|
||||
.with_context(|| format!("failed to remove {path}"))?;
|
||||
Result::<_, anyhow::Error>::Ok(())
|
||||
})
|
||||
}
|
||||
})
|
||||
.collect::<FuturesUnordered<_>>();
|
||||
Some(
|
||||
|
||||
@@ -185,11 +185,15 @@ pub async fn clear_and_reset_video_status(
|
||||
.await?;
|
||||
txn.commit().await?;
|
||||
let video_info = video_info.try_into_model()?;
|
||||
let warning = tokio::fs::remove_dir_all(&video_info.path)
|
||||
.await
|
||||
.context(format!("删除本地路径「{}」失败", video_info.path))
|
||||
.err()
|
||||
.map(|e| format!("{:#}", e));
|
||||
let warning = if video_info.path.is_empty() {
|
||||
None
|
||||
} else {
|
||||
tokio::fs::remove_dir_all(&video_info.path)
|
||||
.await
|
||||
.context(format!("删除本地路径「{}」失败", video_info.path))
|
||||
.err()
|
||||
.map(|e| format!("{:#}", e))
|
||||
};
|
||||
Ok(ApiResponse::ok(ClearAndResetVideoStatusResponse {
|
||||
warning,
|
||||
video: VideoInfo {
|
||||
|
||||
Reference in New Issue
Block a user