fix(dav): CardDAV-Route fing PROPFIND auf /dav/<user>/calendars/ ab

Die CardDAV-Route /<username>/<ab_part>/ ist in Flask spezifischer als
die generische /<path:subpath> des CalDAV-Handlers und hat daher auch
/dav/<user>/calendars/ abgefangen - mit 404, weil 'calendars' nicht mit
'ab-' anfaengt. Ergebnis: DAVx5 bekam auf das Home-Set eine 404 und
zeigte keine Eintraege mehr an.

Fix: wenn ab_part nicht mit 'ab-' anfaengt, an den CalDAV-PROPFIND/OPTIONS
delegieren statt 404 zurueckzugeben.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Hacker 2026-04-13 03:25:46 +02:00
parent 58ba130cd9
commit 0ef480858e
1 changed files with 4 additions and 2 deletions

View File

@ -140,7 +140,8 @@ _DAV_HEADERS = {'DAV': '1, 2, 3, addressbook'}
@dav_bp.route('/<username>/<ab_part>', methods=['OPTIONS'])
def ab_options(username, ab_part):
if not ab_part.startswith('ab-'):
return Response('', 404)
from .caldav import options as _cal_options
return _cal_options(subpath=f'{username}/{ab_part}')
return Response('', 200, {
'DAV': '1, 2, 3, addressbook',
'Allow': 'OPTIONS, PROPFIND, REPORT, GET, PUT, DELETE, PROPPATCH, MKCOL',
@ -152,7 +153,8 @@ def ab_options(username, ab_part):
@basic_auth
def ab_propfind(username, ab_part):
if not ab_part.startswith('ab-'):
return Response('Not found', 404)
from .caldav import propfind as _cal_propfind
return _cal_propfind(subpath=f'{username}/{ab_part}')
user: User = request.dav_user
if username != user.username:
return Response('', 403)