christian-putzke / Roundcube-CardDAV

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

Adding new contacts SabreDAV #39

Open e-dschungel opened 11 years ago

e-dschungel commented 11 years ago

When I try to add a new contact using the Roundcube UI I get the error "An error occurred while saving." after clicking the save button. No new entry is generated on the Carddav server.

CardDAV Server: SabreDAV 1.6.4 or 1.7.1 (I tested both) RC: 0.8.2

e-dschungel commented 11 years ago

SabreDAV 1.6.4 works now. I had an error in my apache configuration. It was blocking PUT requests.

SabreDAV 1.7.1 doesn't work. I did a little debugging and found out that SabreDAV throws an execption because the vcard the cardDAV plugin tries to send does not contain an UID. This is required by the standard. The UID validation came in with this commit: https://github.com/evert/SabreDAV/commit/4e11b8e531401416bfe9a30f7119625a65f8f143

This issue was fixed in the myroundcube fork, see http://myroundcube-plugins.40634.n3.nabble.com/cardDAV-Adding-new-contacts-using-SabreDAV-td4024337.html

mrpurplenz commented 11 years ago

This issue also kills "add new contact" for a baikal server (based on sabreDAV). I can confirm that the carddav_backend.php from the latest myroundcube fork fixed this for baikal too. I think someone should attempt to include the fix here.

ghost commented 11 years ago

This error occurs in all SabreDAV based caldav and carddav servers up to SabreDAV versions 1.6.3-stable (2012-06-12): https://github.com/evert/SabreDAV/blob/1.6/ChangeLog Line:35

tuxgasy commented 11 years ago

Hello! I have the same bug! I can do to fix it? Thank!

tfl commented 11 years ago

As I understand the code a newly generated card does include an UID. However, and that is not the problem of this RC plugin, generating the UUID outside of the carddav server is wrong. The card should be send to the server without an UID using a POST request - not PUT (PUT is for updating a ressource, not creating it). The server itself should then generate that UID, create the record with that UID and send the UID back to the caller.

Now, I use plugin version 0.5.2 with RC 0.9.2 and I still can't create new cards... Sometimes I can't even update a card due to the same error message. If I would find some time to debug this I probably find the reason why this happens ;)

tfl commented 11 years ago

I added a pull request which adds the missing UID to the vcard right before it is uploaded to the server. If you use postgres (as I do) you may probably would like to update your round cube's "config/db.inc.php" reflecting the name of your carddav_contacts sequence

$rcmail_config['db_sequence_carddav_contacts'] = 'carddav_contacts_carddav_contact_id_seq';

As long as I ignored that the vcard was uploaded but RC still reports an error. Now the error is gone but I now have a blank region where the new vcard data should be displayed. In both cases, after reloading the page the contact shows up ;)