mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-12-01 13:24:10 +01:00
Move decoding vCard properties to start of upgrade.
This commit is contained in:
parent
04ddf9eeb8
commit
54e4693b7f
@ -143,6 +143,21 @@ class VCard extends VObject\Component\VCard {
|
||||
|
||||
$warnings = array();
|
||||
|
||||
if ($options & self::UPGRADE) {
|
||||
$this->VERSION = self::DEFAULT_VERSION;
|
||||
foreach($this->children as &$property) {
|
||||
$this->decodeProperty($property);
|
||||
switch((string)$property->name) {
|
||||
case 'LOGO':
|
||||
case 'SOUND':
|
||||
case 'PHOTO':
|
||||
if(isset($property['TYPE']) && strpos((string)$property['TYPE'], '/') === false) {
|
||||
$property['TYPE'] = 'image/' . strtolower($property['TYPE']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$version = $this->select('VERSION');
|
||||
if (count($version) !== 1) {
|
||||
$warnings[] = array(
|
||||
@ -229,21 +244,6 @@ class VCard extends VObject\Component\VCard {
|
||||
}
|
||||
}
|
||||
|
||||
if ($options & self::UPGRADE) {
|
||||
$this->VERSION = self::DEFAULT_VERSION;
|
||||
foreach($this->children as &$property) {
|
||||
$this->decodeProperty($property);
|
||||
switch((string)$property->name) {
|
||||
case 'LOGO':
|
||||
case 'SOUND':
|
||||
case 'PHOTO':
|
||||
if(isset($property['TYPE']) && strpos((string)$property['TYPE'], '/') === false) {
|
||||
$property['TYPE'] = 'image/' . strtolower($property['TYPE']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_merge(
|
||||
parent::validate($options),
|
||||
$warnings
|
||||
|
Loading…
Reference in New Issue
Block a user