mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:11:24 +00:00
WhatsApp: include numbers in contact cards
This commit is contained in:
committed by
Peter Steinberger
parent
e311dc82e0
commit
fd7450e5b9
@@ -32,7 +32,8 @@ export function parseVcard(vcard?: string): ParsedVcard {
|
||||
continue;
|
||||
}
|
||||
if (baseKey === "TEL") {
|
||||
phones.push(value);
|
||||
const phone = normalizeVcardPhone(value);
|
||||
if (phone) phones.push(phone);
|
||||
}
|
||||
}
|
||||
return { name: nameFromFn ?? nameFromN, phones };
|
||||
@@ -56,3 +57,12 @@ function cleanVcardValue(value: string): string {
|
||||
function normalizeVcardName(value: string): string {
|
||||
return value.replace(/;/g, " ").replace(/\s+/g, " ").trim();
|
||||
}
|
||||
|
||||
function normalizeVcardPhone(value: string): string {
|
||||
const trimmed = value.trim();
|
||||
if (!trimmed) return "";
|
||||
if (trimmed.toLowerCase().startsWith("tel:")) {
|
||||
return trimmed.slice(4).trim();
|
||||
}
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user