fix: prefer FN for WhatsApp contact cards (#622) (thanks @mahmoudashraf93)

This commit is contained in:
Peter Steinberger
2026-01-10 00:08:30 +01:00
parent c9c5a71d8b
commit 1277f6e27b
3 changed files with 30 additions and 13 deletions

View File

@@ -44,6 +44,22 @@ describe("web inbound helpers", () => {
expect(body).toBe("<contact: Ada Lovelace, +15555550123>");
});
it("prefers FN over N in WhatsApp vcards", () => {
const body = extractText({
contactMessage: {
vcard: [
"BEGIN:VCARD",
"VERSION:3.0",
"N:Lovelace;Ada;;;",
"FN:Ada Lovelace",
"TEL;TYPE=CELL:+15555550123",
"END:VCARD",
].join("\n"),
},
} as unknown as import("@whiskeysockets/baileys").proto.IMessage);
expect(body).toBe("<contact: Ada Lovelace, +15555550123>");
});
it("extracts multiple WhatsApp contact cards", () => {
const body = extractText({
contactsArrayMessage: {