From 39e68eee6a4960cb8dd6c1c18043b7d51093ce17 Mon Sep 17 00:00:00 2001 From: Stefan Hacker Date: Sun, 12 Apr 2026 14:04:38 +0200 Subject: [PATCH] fix: PROPFIND/OPTIONS auf / (Root) akzeptieren - DAVx5 startet dort DAVx5 macht beim Account-Setup zuerst PROPFIND auf / bevor es /.well-known/caldav probiert. Der Server antwortete mit 405 Method Not Allowed (weil / nur fuer SPA-GET registriert war), woraufhin DAVx5 den gesamten Server als "kein DAV" verwirft. Jetzt: PROPFIND und OPTIONS auf / werden an die DAV-Handler delegiert (gleiches Verhalten wie auf /dav/). GET/HEAD auf / laeuft unveraendert zur SPA. Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/app/__init__.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/backend/app/__init__.py b/backend/app/__init__.py index 20d1aeb..b2f2ccf 100644 --- a/backend/app/__init__.py +++ b/backend/app/__init__.py @@ -1,7 +1,7 @@ import os from pathlib import Path -from flask import Flask, redirect, send_from_directory +from flask import Flask, Response, redirect, send_from_directory from flask_cors import CORS from app.config import Config @@ -119,6 +119,24 @@ def create_app(config_class=Config): provide_automatic_options=False, ) + # Root DAV discovery: DAVx5 und einige andere Clients probieren zuerst + # PROPFIND/OPTIONS auf / (nur Hostname), bevor sie /.well-known nutzen. + # Wir reagieren hier auch mit DAV-Properties. + def _root_dav(): + if request.method == 'PROPFIND': + return dav_propfind(subpath='') + if request.method == 'OPTIONS': + return dav_options() + # GET/HEAD: SPA index handhabt das woanders - dieser View matcht nur DAV-Methoden + return Response('', 405) + + app.add_url_rule( + '/', view_func=_root_dav, + endpoint='_root_dav', + methods=['PROPFIND', 'OPTIONS'], + provide_automatic_options=False, + ) + # iCal export (public, no auth) @app.route('/ical/') def ical_export_route(token):