christian-putzke / Roundcube-CardDAV

Roundcube CardDAV Plugin
http://www.graviox.de
GNU Affero General Public License v3.0
119 stars 28 forks source link

davical : not syncing contact without '.vcf" extension #37

Open nerbrume opened 11 years ago

nerbrume commented 11 years ago

I'm running roundcube 0.8.1 on debian stable, with roundcube-Carddav 5.1, patched following issue 29 (https://github.com/graviox/Roundcube-CardDAV/issues/29)

When syncing my adressbook, contacts which don't have a ".vcf" extension in the davical server are not seen by roundcube-carddav : they do not appear in roundcube (please note that they do not get deleted from the server either : roundcube-carddav just don't "see" them).

roundcube log is clean, roundcube carddav saying that everything was synced correctly.

I would guess this is due to roundcube-carddav pruning elements whithout extension. Any help indicating what to change in the code would be welcome. All I could find are lines which strip the vcf extension in carddav_backend.php.

I can try to provide two example of "synced" and "not synced" contacts if needed, althought the trick here is that it's only a matter of how davical "represent" them in its DB.

tobyX commented 10 years ago

Hi, I have the same problem and fixed it with the added patch:

--- carddav_backend.php.bak     2013-10-18 09:16:06.000000000 +0200
+++ carddav_backend.php 2013-10-18 09:07:25.000000000 +0200
@@ -267,7 +267,11 @@
        public function get_vcard($vcard_id)
        {
                $vcard_id = str_replace($this->ext, null, $vcard_id);
-               return $this->query($this->url . $vcard_id . $this->ext, 'GET');
+               $vCard = $this->query($this->url . $vcard_id . $this->ext, 'GET');
+               if (empty($vCard))
+                       $vCard = $this->query($this->url . $vcard_id, 'GET');
+               return $vCard;
        }

        /**

It's a bit crude, but it does the job.