Sonar integration with NextCloud calendar


I’m looking at the Sonar calendaring option. Some of the team is on OS X/iOS devices. I also have Ubuntu laptops and Android devices. Using iCloud calendars doesn’t seem to work for my Ubuntu and Android devices. So, I’m hoping to get the work related calendaring in Sonar to be the happy medium. So far, it’s not working for me on the Ubuntu/Android side.

I have a NextCloud server running and calendars work from there to everywhere, so far. Since I like NextCloud, I am trying to get the WebDav settings in Sonar to tie to my NextCloud server. I’m getting errors when I lookup available calendars. The URL I entered was “https://server.tld/remote.php/dav/” which is what NextCloud says caldav apps should need to find the root of lambert’s calendars.

Server error: `PROPFIND https://server.tld/remote.php/dav//remote.php/dav/principals/users/lambert/` resulted in a `500 Internal Server Error` response:
<!DOCTYPE html>
<html class="ng-csp" data-placeholder-focus="false" lang="en" data-locale="en" >
data-requesttok (truncated...)

As you can see in the PROPFIND, it appears that Sonar is expecting the hostname only. Okay, fair enough. But that doesn’t work. It returns “Not authorized”…

I had a lot more debugging here, think I have figured it out. I initially figured I had a mis-configuration of NextCloud or that Sonar would just blindly append the full well known URL to the full path given to it. If the later, I probably would have no problems.

Based on what I see in the logs, I think the WebDAV client code is supposed to request the remote.php/dav/ URL to get pointers for the next query. I’m not familiar with the WebDAV protocol.

Unfortunately, it looks like Sonar’s client code is accidentally prepending the “/remote.php/dav/” to the second request where it is looking up the principals/users/lambert part. The log shows that Sonar always requests exactly what I type in the CalDAV URL field first. Then, when the CalDAV URL is not just wrong so that the server responds with a 405 or 404 error, it make a second more specific request with what it thinks should be tacked on. That doesn’t work.

When I feed Sonar “/remote.php/dav/”, the initial request gets a 207 response with 3789 bytes. When I feed Sonar “/remote.php/dav/principals/users/lambert”, the initial request gets a 207 response with 581 bytes. In both cases, the second request gets a 500 response with 4269 bytes.

Without knowing anything about CalDAV, I think Sonar is just including too much well known path in the second request. “/remote.php/dav/” Are there other WebDAV servers which have you request a base URL then make you tack on the “remote.php/dav/” part? If so, the code may have to look for it in the CalDAV URL and strip it if necessary. I know that a lot of software with a “standard” protocol gets implemented by people who read the standards to say completely different things.