From 54f2a6355b368264da74f73e5700d57b9ad35bf1 Mon Sep 17 00:00:00 2001 From: Conrad Hoffmann Date: Tue, 18 Oct 2022 15:45:35 +0200 Subject: [PATCH] caldav: implement Propfind It did not handle Depth or requests to calendar components. This brings the implementation on par with the one CardDAV one. --- caldav/server.go | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/caldav/server.go b/caldav/server.go index 59be95e..3624cec 100644 --- a/caldav/server.go +++ b/caldav/server.go @@ -349,6 +349,8 @@ func (b *backend) PropFind(r *http.Request, propfind *internal.PropFind, depth i return nil, err } + var dataReq CalendarCompRequest + var resps []internal.Response if r.URL.Path == principalPath { @@ -370,10 +372,30 @@ func (b *backend) PropFind(r *http.Request, propfind *internal.PropFind, depth i resps = append(resps, *resp) if depth != internal.DepthZero { - // TODO + cos, err := b.Backend.ListCalendarObjects(r.Context(), &dataReq) + if err != nil { + return nil, err + } + + for _, co := range cos { + resp, err := b.propFindCalendarObject(r.Context(), propfind, &co) + if err != nil { + return nil, err + } + resps = append(resps, *resp) + } } } else { - // TODO + co, err := b.Backend.GetCalendarObject(r.Context(), r.URL.Path, &dataReq) + if err != nil { + return nil, err + } + + resp, err := b.propFindCalendarObject(r.Context(), propfind, co) + if err != nil { + return nil, err + } + resps = append(resps, *resp) } return internal.NewMultiStatus(resps...), nil