diff --git a/src-tauri/src/sync.rs b/src-tauri/src/sync.rs index 3ecd2ad..1398b7a 100644 --- a/src-tauri/src/sync.rs +++ b/src-tauri/src/sync.rs @@ -80,8 +80,13 @@ fn sanitize_filename(title: &str) -> String { // Trim and collapse multiple spaces into single space let normalized: String = sanitized.split_whitespace().collect::>().join(" "); - // Limit length - normalized.chars().take(50).collect() + // Limit length and trim any trailing spaces from truncation + normalized + .chars() + .take(50) + .collect::() + .trim() + .to_string() } // Issue #5: Save article text as markdown