Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(email): allow single quote in email and only check at user creation (#4070)

Will Hutchinson85be65622b9e
diff --git a/rust/cloud-storage/email_validator/src/lib.rs b/rust/cloud-storage/email_validator/src/lib.rs
index ec262291fd..4b6c4163bf 100644
--- a/rust/cloud-storage/email_validator/src/lib.rs
+++ b/rust/cloud-storage/email_validator/src/lib.rs
@@ -4,12 +4,11 @@ use lazy_static::lazy_static;
use regex::Regex;
lazy_static! {
- // Note: the single quote (') is RFC 5322 atext and thus valid in the local part,
- // but we deliberately reject it as a policy choice (matching macro_user_id) — do not add it back.
static ref EMAIL_REGEX: Regex = Regex::new(
- r"^[a-zA-Z0-9.!#$%&*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$"
+ r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$"
)
.unwrap();
+
}
lazy_static! {
@@ -60,12 +59,6 @@ mod tests {
("test@\\test.com", false),
("[email protected]", true),
("[email protected]", true),
- // single quotes are not allowed
- ("o'[email protected]", false),
- ("'[email protected]", false),
- ("test'@test.com", false),
- ("test+ta'[email protected]", false),
- ("test@te'st.com", false),
];
for email in emails {
diff --git a/rust/cloud-storage/macro_user_id/src/email.rs b/rust/cloud-storage/macro_user_id/src/email.rs
index b538a70c19..a082cb35ce 100644
--- a/rust/cloud-storage/macro_user_id/src/email.rs
+++ b/rust/cloud-storage/macro_user_id/src/email.rs
@@ -34,10 +34,8 @@ fn domain(input: &str) -> IResult<&str, &str> {
}
// Parser for local part (before @)
-// Note: the single quote (') is RFC 5322 atext and thus valid in the local part,
-// but we deliberately reject it as a policy choice — do not add it back.
fn atom(input: &str) -> IResult<&str, &str> {
- take_while1(|c: char| c.is_ascii_alphanumeric() || "!#$%&*+/=?^_`{|}~-".contains(c))
+ take_while1(|c: char| c.is_ascii_alphanumeric() || "!#$%&'*+/=?^_`{|}~-".contains(c))
.parse(input)
}
diff --git a/rust/cloud-storage/macro_user_id/src/email/tests.rs b/rust/cloud-storage/macro_user_id/src/email/tests.rs
index 9d3038cb40..d5729cd9e5 100644
--- a/rust/cloud-storage/macro_user_id/src/email/tests.rs
+++ b/rust/cloud-storage/macro_user_id/src/email/tests.rs
@@ -26,12 +26,6 @@ fn it_should_fail() {
"sean@@macro.com",
r#"foo"@macro.com"@example.com"#,
- // single quotes are not allowed
- "sean'@macro.com",
- "sean+ta'[email protected]",
- "sean@mac'ro.com",
];
invalid_emails
.iter()