Skip to content

Commit 82ea29b

Browse files
committed
fix: Add tests for special characters in email
1 parent 71b5053 commit 82ea29b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/text.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn suppress_github_mentions(text: &str) -> String {
1313

1414
let segment = r"[a-zA-Z0-9][a-zA-Z0-9\-]{0,38}";
1515
let pattern = format!(
16-
r"(^|[^a-zA-Z0-9_])(@{0}(?:/{0})*)($|[^a-zA-Z0-9_\-])",
16+
r"(^|[^a-zA-Z0-9_])(@{0}(?:/{0})*)([^a-zA-Z0-9_\-/.]|$)",
1717
segment
1818
);
1919

@@ -70,6 +70,7 @@ mod tests {
7070
suppress_github_mentions("user@example.com"),
7171
"user@example.com"
7272
);
73+
assert_eq!(suppress_github_mentions("abč@user.com"), "abč@user.com");
7374

7475
// Invalid mentions
7576
assert_eq!(suppress_github_mentions("@-user"), "@-user");

0 commit comments

Comments
 (0)