REPRODUCIBILITY: 100%
OS VERSION: 5.0.0.62
HARDWARE: XA2
UI LANGUAGE: pl_PL
REGRESSION: no
DESCRIPTION:
After lighttpd update, I am unable to refresh calendar list in Nextcloud account settings at all (lighttpd is Turris default for Nextcloud).
The reason is that Nextcloud’s .well-known/caldav redirect does not work. I traced the change is now doing a 308 redirect whereas 301 was used before. I manually forced the redirect code back to 301.
This problem is Qt 5.6 missing a 2017 bug fix from Qt 5.9.3+: Add support for HTTP status 308 Permanent Redirect · qt/qtbase@a402b3a · GitHub
Redirect handling itself is in buteo carddav: buteo-sync-plugin-carddav/tools/cdavtool/helpers.cpp at 5d7c5f8d7b254c643bed77372d68646fffb0ba88 · sailfishos/buteo-sync-plugin-carddav · GitHub
The workaround is insufficient for remote calendars, because the remote calendars are not added, but at least the thing is fetched and normal calendars work fine.
Calendar parsing is in the same file: buteo-sync-plugin-carddav/tools/cdavtool/helpers.cpp at 5d7c5f8d7b254c643bed77372d68646fffb0ba88 · sailfishos/buteo-sync-plugin-carddav · GitHub
EDIT: The obvious workaround is to download the remote calendar and upload it to Nextcloud. But it will not update. Or to add it directly as a webcal. Or to add it to an MS exchange or Google account instead of Nextcloud. Don’t worry, I managed to get by.
PRECONDITIONS:
A working Nextcloud account added, and the .well-known/caldav redirect either 301 or 308.
Note that a mitm proxy might come in handy during debugging.
STEPS TO REPRODUCE:
- Add a new remote calendar subscription in Nextcloud web UI (can be any URL to an .ics file that is accessible to Nextcloud).
- Go to Nextcloud account settings in the settings app.
- Click ‘refresh calendars’.
EXPECTED RESULT:
Calendar list updates, remote calendars are added. My expectation is from the fact that MS exchange does add remote calendars for example. (Google might as well, have not checked.)
ACTUAL RESULT:
Error, calendar list stays the same. With the workaround, refreshes fine, but only normal calendars are added.
MODIFICATIONS:
Irrelevant I think? chum and meecast eventsview. And an extra systemwide CA installed, for debugging.
ADDITIONAL INFORMATION:
Log from settings app (don’t ask me how I got it with a custom sgid(privileged) wrapper):
[D] unknown:0 - calendar home path is empty, requesting user principal url
[W] unknown:0 - "XML parse error: 4: Premature end of document."
[D] onError:55 - Calendar update failed: 8 Nie można przetworzyć odpowiedzi serwera.
After changing 308 to 301:
[D] unknown:0 - calendar home path is empty, requesting user principal url
[D] unknown:0 - being redirected from QUrl("https://nextcloud.example/.well-known/caldav") to QUrl("/remote.php/dav")
[D] unknown:0 - Unable to parse calendar from response, have details: "/remote.php/dav/calendars/Arusekk" "" QColor(Invalid)
[D] unknown:0 - found calendar information in response: "/remote.php/dav/calendars/Arusekk/contact_birthdays/" "Urodziny kontaktu" QColor(ARGB 1, 0.913, 0.847, 0.349)
[D] unknown:0 - found calendar information in response: "/remote.php/dav/calendars/Arusekk/personal/" "Osobiste" QColor(ARGB 1, 0, 0.213, 0.931)
[D] unknown:0 - Unable to parse calendar from response, have details: "/remote.php/dav/calendars/Arusekk/somewhereexamplecom/" "Remote calendar from somewhere.example.com" QColor(ARGB 1, 0.5, 0, 0)
Normal calendars have <d:resourcetype><d:collection/><cal:calendar/></d:resourcetype>
and remote calendars have <d:resourcetype><d:collection/><cs:subscribed/></d:resourcetype>
where xml namespaces are <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
.
Sorry for stacking a feature request on top of a bug report. If there are more important things to do for you, I can try implementing it myself, as I do have some spare free time, and the component is open source. But the Qt patch should be backported if Qt cannot yet be upgraded to 5.9.3+, I bet there is more network code that might need modern redirects support. Thanks for all the hard work, despite lagging a bit with respect to latest libraries, SFOS is an excellent piece of software!