mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 17:23:48 -05:00
Merge pull request #11008 from overleaf/msm-fix-email-helper-group
[web] Prevent NPE parsing RFC5322 email groups GitOrigin-RevId: 57fa7dc523b94c44afdd45a790ff6c3e62e45214
This commit is contained in:
parent
84f3d52f3b
commit
62b727fb61
2 changed files with 7 additions and 1 deletions
|
@ -17,7 +17,7 @@ function parseEmail(email, parseRfcAddress = false) {
|
|||
|
||||
if (parseRfcAddress) {
|
||||
const result = parseOneAddress(email)
|
||||
if (!result) {
|
||||
if (!result?.address) {
|
||||
return null
|
||||
}
|
||||
email = result.address
|
||||
|
|
|
@ -29,4 +29,10 @@ describe('EmailHelper', function () {
|
|||
expect(parseEmail(address)).to.equal(null)
|
||||
expect(parseEmail(address, true)).to.equal(null)
|
||||
})
|
||||
|
||||
it('should return null for a group of addresses', function () {
|
||||
const address = 'Group name:test1@example.com,test2@example.com;'
|
||||
expect(parseEmail(address)).to.equal(null)
|
||||
expect(parseEmail(address, true)).to.equal(null)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue