From 938c5ef21ce2870befcc16335998d48ad773433a Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Wed, 9 Nov 2011 11:34:04 +0100 Subject: [PATCH] contacts: every card needs a version! --- apps/contacts/lib/vcard.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index adfa32b6f5..a6795c7935 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -95,10 +95,15 @@ class OC_Contacts_VCard{ $card = self::parse($data); if(!is_null($card)){ + // VCARD must have a version + $hasversion = false; foreach($card->children as $property){ if($property->name == 'FN'){ $fn = $property->value; } + elseif($property->name == 'VERSION'){ + $hasversion = true; + } elseif(is_null($uri) && $property->name == 'UID' ){ $uri = $property->value.'.vcf'; } @@ -109,6 +114,11 @@ class OC_Contacts_VCard{ $card->add(new Sabre_VObject_Property('UID',$uid)); $data = $card->serialize(); }; + // Add version if needed + if(!$hasversion){ + $card->add(new Sabre_VObject_Property('VERSION','3.0')); + $data = $card->serialize(); + } } else{ // that's hard. Creating a UID and not saving it