caldav, carddav: redirect on wrong path

it is much more user-friendly to redirect to the correct
principalPath/homeSetPath when possible
This commit is contained in:
oliverpool
2024-10-04 21:12:08 +02:00
committed by Filip Góra
parent e4babc2798
commit 9c900b1c66
6 changed files with 119 additions and 43 deletions

View File

@@ -64,7 +64,7 @@ func ServeMultiStatus(w http.ResponseWriter, ms *MultiStatus) error {
type Backend interface {
Options(r *http.Request) (caps []string, allow []string, err error)
HeadGet(w http.ResponseWriter, r *http.Request) error
PropFind(r *http.Request, pf *PropFind, depth Depth) (*MultiStatus, error)
PropFind(w http.ResponseWriter, r *http.Request, pf *PropFind, depth Depth) error
PropPatch(r *http.Request, pu *PropertyUpdate) (*Response, error)
Put(w http.ResponseWriter, r *http.Request) error
Delete(r *http.Request) error
@@ -152,12 +152,7 @@ func (h *Handler) handlePropfind(w http.ResponseWriter, r *http.Request) error {
}
}
ms, err := h.Backend.PropFind(r, &propfind, depth)
if err != nil {
return err
}
return ServeMultiStatus(w, ms)
return h.Backend.PropFind(w, r, &propfind, depth)
}
type PropFindFunc func(raw *RawXMLValue) (interface{}, error)