Private
Public Access
1
0

Add normalization for eds resolver

This commit is contained in:
2025-06-26 18:37:23 -07:00
parent 5a399cc6ca
commit e73cf321c0

View File

@@ -164,6 +164,11 @@ impl ContactResolverBackend for EDSContactResolverBackend {
format!("(is \"email\" \"{}\")", address)
} else {
let normalized_address = address
.chars()
.filter(|c| c.is_numeric())
.collect::<String>();
let local_address = address
.replace('+', "")
.chars()
.skip_while(|c| c.is_numeric() || *c == '(' || *c == ')')
@@ -171,9 +176,10 @@ impl ContactResolverBackend for EDSContactResolverBackend {
.chars()
.filter(|c| c.is_numeric())
.collect::<String>();
format!(
"(or (is \"phone\" \"{}\") (is \"phone\" \"{}\") )",
address, normalized_address
"(or (is \"phone\" \"{}\") (is \"phone\" \"{}\") (is \"phone\" \"{}\"))",
address, normalized_address, local_address
)
};