Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NC11, shared addressbook: server advertises a .vcf but doesn't provide it -> 404 #3583

Closed
sbctm opened this issue Feb 22, 2017 · 2 comments
Closed

Comments

@sbctm
Copy link

sbctm commented Feb 22, 2017

Short: Davdroid fails on syncing a shared address book with Nextcloud 11, because NC advertises a .vcf file which it does not provide later on.

Steps to reproduce:

  1. Nextcloud: User 'Michael' shares an address book 'testbook' with the user 'testacc' (editable)
  2. On Android, create a new Davdroid account for the user testacc
  3. Select 'testbook' as addressbook
  4. Sync.

Expected behaviour

As 'testbook' contains one contact, this contact should be synced to the Android device

Actual behaviour

A 404 exception occurs. NC advertises a .vcf file which it does not provide. Here is the verbose log from Davdroid: https://paste.fedoraproject.org/paste/PBE-LTK9DJZ0RBBXUOM2RV5M1UNdIGYhyRLivL9gydE=

Possible reason

What I noticed is, that NC is advertising the contact as
/remote.php/carddav/addressbooks/testacc/testbook_shared_by_Michael/40550d2b-8400-495d-8265-0b540c37713a.vcf
while In the Nextcloud interface, the link shown for this addressbook is
/remote.php/dav/addressbooks/users/testacc/testbook_shared_by_Michael/
(note the /users/ part, which is missing in the advertised path)

Syncing testacc's own addressbook (not the one which was shared by Michael) works just fine, so the issue is related to 'sharing' somehow. I have contacted the davdroid team first, who advised me to open an issue here, see https://forums.bitfire.at/topic/1347/syncing-shared-address-book-with-nextcloud-11-fails as a reference.

Server configuration

Operating system: raspbian jessie

Web server: nginx 1.6.2

Database: mysql Ver 14.14 Distrib 5.5.54, for debian-linux-gnu (armv7l) using readline 6.3

PHP version: PHP 5.6.29-0+deb8u1 (cli) (built: Dec 17 2016 06:04:43)

Nextcloud version: 11.0.1 (stable)

Updated from an older Nextcloud/ownCloud or fresh install: updated from owncloud 8.2.3 -> NC 9 -> NC 10 -> NC 11

Where did you install Nextcloud from: from https://nextcloud.com/changelog/

Signing status:
Are you using encryption: no

Are you using an external user-backend, if yes which one: no

@nickvergessen
Copy link
Member

The two links you compared are 2 different endpoints:

/remote.php/carddav/addressbooks      /testacc/testbook_shared_by_Michael
/remote.php/dav    /addressbooks/users/testacc/testbook_shared_by_Michael

I added spaces so you can easily see where things are different.

The dav/ URL definetly works, because that is also the one used by the web UI.

I debugged it a bit and for me the following change made it work:

diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index a6d057452e..b71c6380a9 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -180,7 +180,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
                                $addressBooks[$row['id']] = [
                                        'id'  => $row['id'],
                                        'uri' => $uri,
-                                       'principaluri' => $principalUri,
+                                       'principaluri' => $principalUriOriginal,
                                        '{DAV:}displayname' => $displayName,
                                        '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
                                        '{http://calendarserver.org/ns/}getctag' => $row['synctoken'],

@sbctm
Copy link
Author

sbctm commented Feb 23, 2017

This works like a charm. Thank you very much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants