Skip to content

Commit a938e57

Browse files
committed
test(rm): reject empty alias paths
1 parent b5e4922 commit a938e57

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • crates/cli/src/commands

crates/cli/src/commands/rm.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ fn parse_rm_path(path: &str) -> Result<(String, String, String), String> {
369369
String::new()
370370
};
371371

372+
if alias.is_empty() {
373+
return Err("Alias name cannot be empty".to_string());
374+
}
375+
372376
if bucket.is_empty() {
373377
return Err("Bucket name cannot be empty".to_string());
374378
}
@@ -420,6 +424,11 @@ mod tests {
420424
assert!(parse_rm_path("").is_err());
421425
}
422426

427+
#[test]
428+
fn test_parse_rm_path_empty_alias() {
429+
assert!(parse_rm_path("/mybucket/file.txt").is_err());
430+
}
431+
423432
#[test]
424433
fn test_delete_request_options_enable_force_delete_for_purge() {
425434
let args = RmArgs {

0 commit comments

Comments
 (0)