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:
Warren
2026-05-17 02:29:00 +08:00
parent 87bac3f201
commit 27fd87d5d5

View File

@@ -827,7 +827,7 @@ async fn upload_file(
hasher.update(input.as_bytes());
let hash = hasher.finalize();
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)
let db_path = crate::filetree::FileTree::user_db_path(&user_id);