From b90f05c0c61df373a999320853eba9f567779944 Mon Sep 17 00:00:00 2001 From: babelouest Date: Sat, 6 Dec 2014 16:42:34 -0500 Subject: [PATCH] fix bug with colon and space that made the import controller guess it's a ldif file instead of a vcard... --- lib/connector/importvcardconnector.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/connector/importvcardconnector.php b/lib/connector/importvcardconnector.php index 35615b81..393d2c1a 100755 --- a/lib/connector/importvcardconnector.php +++ b/lib/connector/importvcardconnector.php @@ -198,20 +198,9 @@ class ImportVCardConnector extends ImportConnector{ // Doesn't look like a vcf file return 0; } else { - try { - $vcard = VObject\Reader::read($parts[0]); - } catch (VObject\ParseException $e) { - // error while parsing, doesn't look like a vcard - return 0; - } - $toTranslate=1; - foreach ($vcard->children() as $vcardProperty) { - $importEntry = $this->getImportEntry($vcardProperty, $vcard); - if ($importEntry) { - $toTranslate++; - } - } - return (1 - pow(0.5, $toTranslate)); + $element = $this->convertElementToVCard($parts[0]); + $unknownElements = $element->select("X-Unknown-Element"); + return (1 - (0.5 * count($unknownElements)/count($parts[0]))); } }