From e27a61a50dfad9218e8cc502a69b5468ae5f2a51 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 18 Nov 2012 12:58:49 +0100 Subject: Skip invalid vCards (#1488788) --- plugins/vcard_attachments/package.xml | 70 ++++++++++++++++++++----- plugins/vcard_attachments/vcard_attachments.php | 17 +++--- 2 files changed, 69 insertions(+), 18 deletions(-) diff --git a/plugins/vcard_attachments/package.xml b/plugins/vcard_attachments/package.xml index 82b750ad5..9fdf0acf2 100644 --- a/plugins/vcard_attachments/package.xml +++ b/plugins/vcard_attachments/package.xml @@ -19,11 +19,10 @@ alec@alec.pl yes - 2012-04-13 - + 2012-11-18 - 3.1 - 3.1 + 3.2 + 3.2 stable @@ -31,11 +30,7 @@ GNU GPLv3+ -- Fixed doble urlencoding of vcard identifier -- Fixed encoding when default charset is different than vcard charset -- Improved vcards import to work as addressbook::import procedure (with validation and autofix) -- Support IDNA -- Import contacts to default addressbook +- Skip invalid vcards (#1488788) @@ -47,19 +42,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -135,7 +162,26 @@ - Exec contact_create hook when adding contact (#1486964) - Make icons skinable - Display vcard icon on messages list when message is of type vcard - - - + + + + 2012-04-13 + + 3.1 + 3.1 + + + stable + stable + + GNU GPLv3+ + +- Fixed doble urlencoding of vcard identifier +- Fixed encoding when default charset is different than vcard charset +- Improved vcards import to work as addressbook::import procedure (with validation and autofix) +- Support IDNA +- Import contacts to default addressbook + + + diff --git a/plugins/vcard_attachments/vcard_attachments.php b/plugins/vcard_attachments/vcard_attachments.php index ed6d45325..e7f7d5f1f 100644 --- a/plugins/vcard_attachments/vcard_attachments.php +++ b/plugins/vcard_attachments/vcard_attachments.php @@ -69,17 +69,22 @@ class vcard_attachments extends rcube_plugin $vcards = rcube_vcard::import($this->message->get_part_content($part, null, true)); // successfully parsed vcards? - if (empty($vcards)) + if (empty($vcards)) { continue; + } // remove part's body - if (in_array($part, $this->vcard_bodies)) + if (in_array($part, $this->vcard_bodies)) { $p['content'] = ''; + } foreach ($vcards as $idx => $vcard) { - $display = $vcard->displayname; - if ($vcard->email[0]) - $display .= ' <'.$vcard->email[0].'>'; + // skip invalid vCards + if (empty($vcard->email) || empty($vcard->email[0])) { + continue; + } + + $display = $vcard->displayname . ' <'.$vcard->email[0].'>'; // add box below message body $p['content'] .= html::p(array('class' => 'vcardattachment'), @@ -108,7 +113,7 @@ class vcard_attachments extends rcube_plugin */ function save_vcard() { - $this->add_texts('localization', true); + $this->add_texts('localization', true); $uid = get_input_value('_uid', RCUBE_INPUT_POST); $mbox = get_input_value('_mbox', RCUBE_INPUT_POST); -- cgit v1.2.3