maps
maps copied to clipboard
Cannot place contact via map »Failed to place contact: "READONLY"«
I wanted to place a contact via the map. I was gettng the dialog asking me for the contact I want to place as well as whether it should be its home or working adress. However, after choosing the flags I'm getting the error:
Failed to place contact: "READONLY"✖
Unfortunately this message might be true, but is not very helpful. I have no idea what the issue is. Running maps: 0.1.6 on Nextcloud 18.0.5.
Is the contact in a shared addressbook? Can you edit the contact in the contacts app?
No -- its not shared and I can edit it.
@nextcloud/contacts Does anybody has an Idea, why an addressbook is appears to be read only for maps, but the contact is editable from the contacts app? This is how maps determs if the addressBook is read only:
private function addressBookIsReadOnly($bookid) {
$userBooks = $this->cdBackend->getAddressBooksForUser('principals/users/'.$this->userId);
foreach ($userBooks as $book) {
if ($book['id'] === $bookid) {
return (isset($book['{http://owncloud.org/ns}read-only']) and $book['{http://owncloud.org/ns}read-only']);
}
}
return true;
}
@frlan could you generate a system report https://your.instance/settings/admin/support and upload or email it to me. I'm not shure if it is there allready for NC 18, but there might be a menu point report issue.
no idea! :/ @georgehrke
The readonly attribute is set here: https://github.com/nextcloud/server/blob/de35da37ceffe7468c1e30d6067f99b881aff2b5/apps/dav/lib/CardDAV/CardDavBackend.php#L224
It is never set for addressbooks you own though: https://github.com/nextcloud/server/blob/de35da37ceffe7468c1e30d6067f99b881aff2b5/apps/dav/lib/CardDAV/CardDavBackend.php#L159
There is also a check that shared addressbooks don't override your own, so that can't be the reason: https://github.com/nextcloud/server/blob/de35da37ceffe7468c1e30d6067f99b881aff2b5/apps/dav/lib/CardDAV/CardDavBackend.php#L194
The error is only Raised if the addressBookIsReadOnly returns true: https://github.com/nextcloud/maps/blob/d1d440b3f6072b897cc6b5de43fe55f059750a4c/lib/Controller/ContactsController.php#L174.
This never happens if the addressbook is your own.
So I guess we need some more information from @frlan. A compled filled out template https://github.com/nextcloud/server/blob/master/.github/ISSUE_TEMPLATE/Bug_report.md could be helpfull.
@tacruc The only possible source of error i could spot in your code is this line:
if ($book['id'] === $bookid) {
We do not explicitly typecast it in the backend, so depending on the type of $bookid
, this condition may never be true. Better explicitly typecast $book['id']
to the same type as $bookid
https://github.com/nextcloud/server/blob/862e3250fffa78c0d0a51f20034369abf99fc468/apps/dav/lib/CardDAV/CardDavBackend.php#L160
@georgehrke thanks, I will have a look into it. One possible issue I see is, that $bookid is not fixed in type either.
Would make $book['id'] == $bookid
make sense than?
I'm not sure if my diagnostics will be particularly useful here, but I'm experiencing the exact same issue @frlan described, on Nextcloud 19.0.4 and Maps 0.1.6. The contact is in my own address book, and I definitely have write access to it. Happy to provide any logs or diagnostic dumps that are required!
Could it be caused by the index contact_uid stripped out in https://github.com/nextcloud/maps/commit/1a76b935a2459be64abfbdb86072129d12e45856?
The issue still exists with Nextcloud 21.0.4 and maps 0.1.9
It's a duplicate of #222
Also it doesn't only affect contacts when placed via the map. Contacts that have adresses added via the Contacts app don't appear on the map either.
Also seeing this in v23