carlos22 / carddav2fb

:notebook: A command-line PHP script allowing to import CardDAV-based VCards (e.g. from 'owncloud') to a phonebook in a AVM FRITZ!Box
The Unlicense
86 stars 66 forks source link

link to photo wrong when using usb_disk config option #8

Open gordin123 opened 8 years ago

gordin123 commented 8 years ago

Due to a missing slash in carddav2fb.php:569 before "FRITZ" the URL to the contact image is wrong when using the usb_disk config option.

diff --git a/carddav2fb.php b/carddav2fb.php
index 86993f3..dc0b226 100644
--- a/carddav2fb.php
+++ b/carddav2fb.php
@@ -566,7 +566,7 @@ class CardDAV2FB
         unlink($photo_file . ".b64");

         // add contact photo to xml
-        $person->addChild("imageURL", $this->config['fritzbox_path'].$this->config['usb_disk']."FRITZ/fonpix/".basename($photo_file));
+        $person->addChild("imageURL", $this->config['fritzbox_path'].$this->config['usb_disk']."/FRITZ/fonpix/".basename($photo_file));

         print "  Added photo: " . basename($photo_file) . PHP_EOL;
       }

Side note: uploading the file works as in carddav2fb.php:634 the remote path is set correctly: $remote_path = $this->config['usb_disk']."/FRITZ/fonpix";