mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 08:14:15 +00:00
caldav: implement Propfind
It did not handle Depth or requests to calendar components. This brings the implementation on par with the one CardDAV one.
This commit is contained in:
parent
001e5953f7
commit
54f2a6355b
@ -349,6 +349,8 @@ func (b *backend) PropFind(r *http.Request, propfind *internal.PropFind, depth i
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dataReq CalendarCompRequest
|
||||||
|
|
||||||
var resps []internal.Response
|
var resps []internal.Response
|
||||||
|
|
||||||
if r.URL.Path == principalPath {
|
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)
|
resps = append(resps, *resp)
|
||||||
|
|
||||||
if depth != internal.DepthZero {
|
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 {
|
} 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
|
return internal.NewMultiStatus(resps...), nil
|
||||||
|
Loading…
Reference in New Issue
Block a user