Skip to content

Commit 4840a59

Browse files
committed
Don't output empty properties for CardDav requests. Bug: 12782
1 parent 5e9026d commit 4840a59

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

turba/lib/Api.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public function browse($path = '',
356356
}
357357
if (in_array('contentlength', $properties)) {
358358
try {
359-
$data = $this->export($contact->getValue('__uid'), 'text/x-vcard', $contact->getSource());
359+
$data = $this->export($contact->getValue('__uid'), 'text/x-vcard', $contact->getSource(), null, array('skip_empty' => true));
360360
} catch (Turba_Exception $e) {
361361
$data = '';
362362
}
@@ -387,7 +387,7 @@ public function browse($path = '',
387387
$contact = $driver->getObject($parts[2]);
388388

389389
$result = array(
390-
'data' => $this->export($contact->getValue('__uid'), 'text/x-vcard', $contact->getSource()),
390+
'data' => $this->export($contact->getValue('__uid'), 'text/x-vcard', $contact->getSource(), null, array('skip_empty' => true)),
391391
'mimetype' => 'text/x-vcard'
392392
);
393393
$modified = $this->_modified($contact->getValue('__uid'), $parts[1]);
@@ -818,7 +818,7 @@ public function export($uid, $contentType, $sources = null, $fields = null, arra
818818
case 'text/directory':
819819
$export = '';
820820
foreach ($result->objects as $obj) {
821-
$vcard = $sdriver->tovCard($obj, $version, $fields);
821+
$vcard = $sdriver->tovCard($obj, $version, $fields, !empty($options['skip_empty']));
822822
/* vCards are not enclosed in
823823
* BEGIN:VCALENDAR..END:VCALENDAR. Export the individual
824824
* cards instead. */

0 commit comments

Comments
 (0)