Skip to content

Commit

Permalink
Allow ! in project/role names
Browse files Browse the repository at this point in the history
  • Loading branch information
brollb committed Nov 10, 2023
1 parent 0669cae commit 2bba379
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/cloud/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fn is_valid_name(name: &str) -> bool {
let min_len = 1;
let char_count = name.chars().count();
lazy_static! {
static ref NAME_REGEX: Regex = Regex::new(r"^[\w\d_][\w\d_ \(\)\.,'\-]*$").unwrap();
static ref NAME_REGEX: Regex = Regex::new(r"^[\w\d_][\w\d_ \(\)\.,'\-!]*$").unwrap();
}

char_count >= min_len
Expand Down Expand Up @@ -450,6 +450,11 @@ mod tests {
assert!(!is_valid_name("hell"));
}

#[actix_web::test]
async fn test_is_valid_name_bang() {
assert!(is_valid_name("hello!"));
}

#[actix_web::test]
async fn test_get_unique_name() {
let names = ["name", "name (2)", "name (3)", "name (4)"].into_iter();
Expand Down

0 comments on commit 2bba379

Please sign in to comment.