fix(dav): Principal-PROPFIND liefert calendars/ + addressbooks/ Container bei Depth 1

DAVx5 brauchte Kind-Container unter /dav/<user>/ - sonst blieben die
Listen nach Aktualisieren leer. Die Home-Sets bleiben getrennt
(calendar-home-set vs addressbook-home-set), aber der Principal zeigt
beide Sub-Container jetzt explizit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Hacker 2026-04-12 15:33:03 +02:00
parent 24a6015841
commit 230c83f124
1 changed files with 14 additions and 3 deletions

View File

@ -269,13 +269,24 @@ def propfind(subpath=''):
multistatus.append(_principal_response(user))
return _xml_response(multistatus)
# /dav/<username>/ : principal only (no child collections in this listing
# so clients don't mix calendars and addressbooks). Clients follow
# calendar-home-set / addressbook-home-set for the actual lists.
# /dav/<username>/ : principal itself + the two sub-containers as
# collection children (calendars/ and addressbooks/). The actual
# calendar/addressbook lists live under those home-sets.
if len(parts) == 1:
if parts[0] != user.username:
return Response('', 403)
multistatus.append(_principal_response(user))
if depth != '0':
for (sub, dn) in (('calendars', 'Kalender'), ('addressbooks', 'Adressbücher')):
container = ET.Element(_qn('d', 'response'))
ET.SubElement(container, _qn('d', 'href')).text = f'/dav/{user.username}/{sub}/'
propstat = ET.SubElement(container, _qn('d', 'propstat'))
prop = ET.SubElement(propstat, _qn('d', 'prop'))
rt = ET.SubElement(prop, _qn('d', 'resourcetype'))
ET.SubElement(rt, _qn('d', 'collection'))
ET.SubElement(prop, _qn('d', 'displayname')).text = dn
ET.SubElement(propstat, _qn('d', 'status')).text = 'HTTP/1.1 200 OK'
multistatus.append(container)
return _xml_response(multistatus)
# /dav/<username>/calendars/ : only calendar collections