mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-10 14:44:52 +08:00
[local-sync] Fix contact parsing from T7327
Summary: See description at T7327 Test Plan: Manual, but this should have unit tests Reviewers: mark, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3513
This commit is contained in:
parent
e17b6d8d17
commit
3910799683
1 changed files with 6 additions and 1 deletions
|
@ -24,9 +24,14 @@ function extractContacts(input) {
|
||||||
const s = `["${input[0].replace(/"/g, '\\"').replace(/, /g, '", "')}"]`;
|
const s = `["${input[0].replace(/"/g, '\\"').replace(/, /g, '", "')}"]`;
|
||||||
const values = JSON.parse(s);
|
const values = JSON.parse(s);
|
||||||
return values.map(v => {
|
return values.map(v => {
|
||||||
const {name, address: email} = mimelib.parseAddresses(v).pop()
|
const parsed = mimelib.parseAddresses(v)
|
||||||
|
if (!parsed || parsed.length === 0) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
const {name, address: email} = parsed.pop()
|
||||||
return {name, email}
|
return {name, email}
|
||||||
})
|
})
|
||||||
|
.filter(c => c != null)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue