fix: Fix string slice syntax error in UUID generation
Fixed compilation error: - hex[0..32].to_string() → hex.chars().take(32).collect::<String>() - Rust doesn't allow direct slicing on String UUID generation method: SHA256(path|filename|mac|mtime).chars().take(32) Properties: - path: absolute file path - filename: uploaded filename - MAC: from ifconfig en0 (ether) - mtime: file modification time (milliseconds) Result: - Deterministic UUID (same file = same UUID) - 32-char hex string - Matches momentry system format Files: - src/server.rs (line 827: chars().take(32).collect())
This commit is contained in:
@@ -827,7 +827,7 @@ async fn upload_file(
|
|||||||
hasher.update(input.as_bytes());
|
hasher.update(input.as_bytes());
|
||||||
let hash = hasher.finalize();
|
let hash = hasher.finalize();
|
||||||
let hex = format!("{:x}", hash);
|
let hex = format!("{:x}", hash);
|
||||||
let file_uuid = hex[0..32].to_string();
|
let file_uuid = hex.chars().take(32).collect::<String>();
|
||||||
|
|
||||||
// Save to database (user-specific SQLite)
|
// Save to database (user-specific SQLite)
|
||||||
let db_path = crate::filetree::FileTree::user_db_path(&user_id);
|
let db_path = crate::filetree::FileTree::user_db_path(&user_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user