diff --git a/src/gerrit_project.rs b/src/gerrit_project.rs index 85b31b1..8758229 100644 --- a/src/gerrit_project.rs +++ b/src/gerrit_project.rs @@ -27,7 +27,7 @@ impl GerritProject { r"(?x) ^ ssh:// - (?P[[:word:]]+) + (?P([[:word:]$.+!*'(),;?&=-]|%[0-9a-fA-F]{2})+) @ (?P[[:word:]][[:word:].-]*) : @@ -86,11 +86,13 @@ mod tests { #[test] fn test_gerrit_parse_remote_url() { assert_eq!( - GerritProject::parse_from_remote_url("ssh://rbt@ooga.booga.systems:2022/ouppy/abc") - .unwrap(), + GerritProject::parse_from_remote_url( + "ssh://joe.rbt%8f@ooga.booga.systems:2022/ouppy/abc" + ) + .unwrap(), GerritProject { host: GerritHost { - username: "rbt".to_owned(), + username: "joe.rbt%8f".to_owned(), host: "ooga.booga.systems".to_owned(), port: 2022, }, @@ -98,4 +100,12 @@ mod tests { } ); } + + #[test] + fn test_gerrit_parse_remote_url_fail() { + assert!(GerritProject::parse_from_remote_url( + "ssh://joe.rbt%j@ooga.booga.systems:2022/ouppy/abc", + ) + .is_err()); + } }