分离产物使用 UUID 文件名
切分图片文件名改用 UUID,避免把 NodeId 当作物理路径。 继续通过 cut_paths 写入 BoundNode.cut_image_path,保留逻辑节点 ID 与产物路径的独立性。
This commit is contained in:
+2
-7
@@ -20,6 +20,7 @@ use std::collections::HashMap;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::time::Instant;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub(crate) async fn separate_ui_impl(
|
||||
project_path: String,
|
||||
@@ -205,13 +206,7 @@ pub(crate) async fn separate_ui_impl(
|
||||
} = decision
|
||||
{
|
||||
let node_id = to_node.as_str();
|
||||
if !node_id.chars().all(|character| {
|
||||
character.is_ascii_alphanumeric() || matches!(character, '-' | '_')
|
||||
}) {
|
||||
cut_error = Some(format!("节点 {} 的名称包含非法路径字符", node_id));
|
||||
break;
|
||||
}
|
||||
let cut_path = sidecar.join(format!("cut-{node_id}.png"));
|
||||
let cut_path = sidecar.join(format!("cut-{}.png", Uuid::new_v4()));
|
||||
if !cut_path.starts_with(&sidecar) {
|
||||
cut_error = Some(format!("节点 {} 的路径越界", node_id));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user