fix: Set temporary file_uuid for files without SHA256

Problem:
- File nodes had null file_uuid
- Clicking files in UI showed nothing (showDetail() returned early)
- User could not view file details

Solution:
- Set file_uuid to node_id (temporary value) during scan
- Even without SHA256 hash, files can be clicked
- file_uuid will be updated when hash is calculated

Result:
- All files have file_uuid 
- Clicking files shows detail panel 
- UI fully functional 

Files:
- src/scan.rs (file_uuid = node_id)
This commit is contained in:
Warren
2026-05-17 04:07:32 +08:00
parent d783fdc397
commit 5dbe69d08f
3 changed files with 6 additions and 4 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -146,8 +146,6 @@ pub fn scan_directory(user_id: &str, dir: &str, batch_size: usize, options: Scan
let node_id = generate_uuid(path_str, filename, &mac, mtime_secs);
file_info.push((node_id.clone(), path_str.clone()));
let file_dir = Path::new(path_str).parent().unwrap_or(dir_path);
let parent_node_id = if file_dir == dir_path {
Some(root_node_id.clone())
@@ -155,15 +153,19 @@ pub fn scan_directory(user_id: &str, dir: &str, batch_size: usize, options: Scan
folder_id_map.get(file_dir.to_string_lossy().as_ref()).cloned()
};
let node_id_clone = node_id.clone();
file_info.push((node_id_clone.clone(), path_str.clone()));
file_nodes.push(FileNode {
node_id,
node_id: node_id_clone.clone(),
label: filename.clone(),
aliases: {
let mut aliases = Aliases::empty();
aliases.set("path", path_str);
aliases
},
file_uuid: None,
file_uuid: Some(node_id_clone.clone()),
sha256: None,
parent_id: parent_node_id,
children: Vec::new(),