Nextcloud failed to sync CardDAV

REPRODUCIBILITY (% or how often): 100%
BUILD ID = OS VERSION (Settings > About product): 4.0.1
HARDWARE (XA2, Xperia 10…): Xperia 10
UI LANGUAGE: German
REGRESSION: (compared to previous public release: Yes, No, ?): No

DESCRIPTION:

Nextcloud CardDAV sync fails silently, but all other functions, including CalDAV sync, are working.

PRECONDITIONS:

If nextcloud is located in a sub directory (e.g. https://my.example.com/nextcloud) and there is no redirect configured for /.well-known/carddav to /nextcloud/remote.php/dav then the sync will fail with the following message:

Mär 11 13:20:03 Sailfish carddav-client[2571]: [W] unknown:0 - void CardDav::userInformationResponse() error: NetworkReply::NetworkError(ContentOperationNotPermittedError) ( 405 ) to request "https://my.example.com/"
Mär 11 13:20:03 Sailfish carddav-client[2571]: [W] unknown:0 - CardDAV sync for account:  10  finished with error: 405
Mär 11 13:20:03 Sailfish carddav-client[2571]: [W] unknown:0 - QMetaObject::invokeMethod: No such method Syncer::syncFinishedWithError()

Mär 11 13:20:03 Sailfish carddav-client[2571]: [W] unknown:0 - void CardDav::userInformationResponse() error: QNetworkReply::NetworkError(ContentOperationNotPermittedError) ( 405 ) to request "https://my.example.com/nextcloud//"
Mär 11 13:20:03 Sailfish carddav-client[2571]: [D] unknown:0 - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
Mär 11 13:20:03 Sailfish carddav-client[2571]: [D] unknown:0 - "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
Mär 11 13:20:03 Sailfish carddav-client[2571]: [D] unknown:0 - "  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
Mär 11 13:20:03 Sailfish carddav-client[2571]: [D] unknown:0 - "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">"
Mär 11 13:20:03 Sailfish carddav-client[2571]: [D] unknown:0 - "<head>"
Mär 11 13:20:03 Sailfish carddav-client[2571]: [D] unknown:0 - "<title>Method not allowed!</title>"

Mär 11 13:20:03 Sailfish carddav-client[2571]: [D] unknown:0 - void CardDav::fetchUserInformation() requesting principal urls for user
Mär 11 13:20:03 Sailfish carddav-client[2571]: [D] unknown:0 - generateRequest(): "" QUrl("https://user@my.example.com/.well-known/carddav") "0" "PROPFIND" "<d:propfind xmlns:d=\"DAV:\"><d:prop><d:current-user-principal /></d:prop></d:propfind>"
Mär 11 13:20:03 Sailfish carddav-client[2571]: [W] unknown:0 - void CardDav::userInformationResponse() error: QNetworkReply::NetworkError(ContentOperationNotPermittedError) ( 405 ) to request "https://my.example.com/.well-known/carddav"

msyncd logging was increased with:

cat << EOT > /etc/sysconfig/msyncd
QTCONTACTS_SQLITE_TWCSA_TRACE=1
QTCONTACTS_SQLITE_TRACE=1
MSYNCD_LOGGING_LEVEL=8
EOT
systemctl --user edit msyncd.service
[Service]
EnvironmentFile=/etc/sysconfig/msyncd
systemctl --user daemon-reload
systemctl --user restart msyncd

STEPS TO REPRODUCE:

  1. Install nextcloud in a subdir (e.g. /nextcloud)
  2. Add Nextcloud account
  3. Force sync or wait for synchronisation

EXPECTED RESULT:

carddav-client recognizes that Nextcloud is installed in a subdirectory (visible from the server address) and adds the subdirectory to the search path (e.g. /nextcloud/.well-known/carddav).
This would make the contact sync successfull.

ACTUAL RESULT:

Contact sync fails silently. Default logging options didn’t say anything about a failed sync or any reason for that.

ADDITIONAL INFORMATION:

(Please ALWAYS attach relevant data such as logs, screenshots, etc…)

I think there are a few reports like this… e.g., [3.4.0.24][4.0.1.48] CalDav sync with Nextcloud server fails
It does seem like if you don’t have Nextcloud in its own domain, SFOS doesn’t like it.
SFOS also doesn’t have all the hacks that other programs implement to work around well known directories, so it always pays to run Nextcloud’s security check, which identifies these issues.

1 Like

Yes, after move Nextcloud to subdomain the issue has been sloved. Thank you for a guess!