From 27fd87d5d54ccfa4686c2054360c9700499878de Mon Sep 17 00:00:00 2001 From: Warren Date: Sun, 17 May 2026 02:29:00 +0800 Subject: [PATCH] fix: Fix string slice syntax error in UUID generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed compilation error: - hex[0..32].to_string() → hex.chars().take(32).collect::() - 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()) --- src/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.rs b/src/server.rs index 2242eb9..e3a3f84 100644 --- a/src/server.rs +++ b/src/server.rs @@ -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::(); // Save to database (user-specific SQLite) let db_path = crate::filetree::FileTree::user_db_path(&user_id);