Bug 405152 - Copy/Paste local contact in KAddressBook breaks data in ~/.local/share/contacts/
Summary: Copy/Paste local contact in KAddressBook breaks data in ~/.local/share/contacts/
Status: REPORTED
Alias: None
Product: kaddressbook
Classification: Applications
Component: general (show other bugs)
Version: GIT
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-06 20:31 UTC by Helmar Gerloni
Modified: 2019-03-06 20:32 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Helmar Gerloni 2019-03-06 20:31:08 UTC
When copy/pasting a contact in KAddressBook the data in ~/.local/share/contacts/ gets corrupted. Always reproducible in current KDE Neon (kaddressbook 4:18.12.2+p18.04+git20190228.0023-0) and also on Debian Buster.

Steps to reproduce:
- Start KAddressBook with empty local address book "Personal Contacts".
- Create one contact in the local "Personal Contacts"
- Contact shows up in ~/.local/share/contacts/113b24d7-6248-48ac-9087-01ca561a2955.vcf.
- Right click on the contact, Copy Contact To -> Personal Contacts.
- Contact now shows up twice in the address book "Personal Contacts" (as expected), but it still shows up only once in ~/.local/share/contacts/.
- When you modify one of the contacts in KAddressBook, the File 113b24d7-6248-48ac-9087-01ca561a2955.vcf in ~/.local/share/contacts/ is always overwritten with the last modified contact.
- So while in KAddressBook everything looks as expected (because it uses the data from the Akonadi cache?) the "real data" in ~/.local/share/contacts/ is corrupted; one contact is missing.

This may seem like a minor problem, but it gets serious when you copy the contact missing in ~/.local/share/contacts/ to a DAV server (Nextcloud in my case).
The contact is not copied, and Akonadi shows the following error (in ~/.xsession-errors):
  org.kde.pim.davresource: DavGroupwareResource::onItemFetched: Failed to parse item data.  "https://nextcloud.mydomain.tld/remote.php/dav/addressbooks/users/testuser/contacts/1551900153.R643.vcf"
The error is obvious since the Nextcloud server responds with a 401 "http unauthorized" error and a "Not Found" html message (the contact does not exist on the server).
From now on Akonadi refuses to synchronize any data with the DAV server, also the calendar is not synchronized any more (by the way this seems to be another error).
After removing the broken contact from the Nextcloud addressbook in KAddressBook followed by "akonadictl restart" everything (in Nextcloud) works again as expected.
The problem with the local contact can simply be fixed by deleting the broken contact from KAddressBook, but it's quite tricky to find out what really went wrong when running into this problem. Also when backing up the "real data" in ~/.local/share/contacts/ you do not get all contacts you see in KAddressBook.