From e8d1b7eb9fe09ca62c1c46114cdcfccc77f2f77c Mon Sep 17 00:00:00 2001 From: overtrue Date: Sun, 12 Apr 2026 22:04:09 +0800 Subject: [PATCH] test(rm): reject empty alias paths --- crates/cli/src/commands/rm.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/cli/src/commands/rm.rs b/crates/cli/src/commands/rm.rs index 2cf033a..8798208 100644 --- a/crates/cli/src/commands/rm.rs +++ b/crates/cli/src/commands/rm.rs @@ -369,6 +369,10 @@ fn parse_rm_path(path: &str) -> Result<(String, String, String), String> { String::new() }; + if alias.is_empty() { + return Err("Alias name cannot be empty".to_string()); + } + if bucket.is_empty() { return Err("Bucket name cannot be empty".to_string()); } @@ -420,6 +424,11 @@ mod tests { assert!(parse_rm_path("").is_err()); } + #[test] + fn test_parse_rm_path_empty_alias() { + assert!(parse_rm_path("/mybucket/file.txt").is_err()); + } + #[test] fn test_delete_request_options_enable_force_delete_for_purge() { let args = RmArgs {