From 73ba902501233c8461b100b42b6be59d62c5c3cb Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 17 May 2016 07:44:17 +0200 Subject: [PATCH] Improved handling/parsing with invalid email addresses like "undisclosed-recipients: ;". --- .../ticket_zoom/article_actions.coffee | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee index 735c87509..ff2a54fd3 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee @@ -95,16 +95,17 @@ class App.TicketZoomArticleActions extends App.Controller forgeinRecipients = [] recipientUsed = {} for recipient in recipients - localRecipientAddeess = recipient.address.toString().toLowerCase() - if !recipientUsed[localRecipientAddeess] - recipientUsed[localRecipientAddeess] = true - localAddess = false - for address in localAddresses - if localRecipientAddeess is address.email.toString().toLowerCase() - recipientUsed[localRecipientAddeess] = true - localAddess = true - if !localAddess - forgeinRecipients.push recipient + if !_.isEmpty(recipient.address) + localRecipientAddeess = recipient.address.toString().toLowerCase() + if !recipientUsed[localRecipientAddeess] + recipientUsed[localRecipientAddeess] = true + localAddess = false + for address in localAddresses + if localRecipientAddeess is address.email.toString().toLowerCase() + recipientUsed[localRecipientAddeess] = true + localAddess = true + if !localAddess + forgeinRecipients.push recipient # check if reply all is neede if forgeinRecipients.length > 1 @@ -289,7 +290,7 @@ class App.TicketZoomArticleActions extends App.Controller # filter for uniq recipients recipientAddresses = {} recipient = emailAddresses.parseAddressList(articleNew.to) - if recipient && recipient[0] + if recipient && recipient[0] && !_.isEmpty(recipient[0].address) recipientAddresses[ recipient[0].address.toString().toLowerCase() ] = true if all addAddresses = (lineNew, addressLine) -> @@ -297,12 +298,12 @@ class App.TicketZoomArticleActions extends App.Controller recipients = emailAddresses.parseAddressList(addressLine) if recipients for recipient in recipients - if recipient.address + if !_.isEmpty(recipient.address) # check if addess is not local localAddess = false for address in localAddresses - if recipient.address.toString().toLowerCase() == address.email.toString().toLowerCase() + if !_.isEmpty(recipient.address) && recipient.address.toString().toLowerCase() == address.email.toString().toLowerCase() localAddess = true if !localAddess