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:
BIN
data/auth.sqlite
BIN
data/auth.sqlite
Binary file not shown.
Binary file not shown.
10
src/scan.rs
10
src/scan.rs
@@ -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);
|
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 file_dir = Path::new(path_str).parent().unwrap_or(dir_path);
|
||||||
let parent_node_id = if file_dir == dir_path {
|
let parent_node_id = if file_dir == dir_path {
|
||||||
Some(root_node_id.clone())
|
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()
|
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 {
|
file_nodes.push(FileNode {
|
||||||
node_id,
|
node_id: node_id_clone.clone(),
|
||||||
label: filename.clone(),
|
label: filename.clone(),
|
||||||
aliases: {
|
aliases: {
|
||||||
let mut aliases = Aliases::empty();
|
let mut aliases = Aliases::empty();
|
||||||
aliases.set("path", path_str);
|
aliases.set("path", path_str);
|
||||||
aliases
|
aliases
|
||||||
},
|
},
|
||||||
file_uuid: None,
|
file_uuid: Some(node_id_clone.clone()),
|
||||||
sha256: None,
|
sha256: None,
|
||||||
parent_id: parent_node_id,
|
parent_id: parent_node_id,
|
||||||
children: Vec::new(),
|
children: Vec::new(),
|
||||||
|
|||||||
Reference in New Issue
Block a user