Ensure resourcetype is always defined

This commit is contained in:
Simon Ser 2020-01-17 17:09:44 +01:00
parent 34b2ebf940
commit bf666bb2fb
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -120,6 +120,12 @@ type PropfindFunc func(raw *RawXMLValue) (interface{}, error)
func NewPropfindResponse(href string, propfind *Propfind, props map[xml.Name]PropfindFunc) (*Response, error) {
resp := NewOKResponse(href)
if _, ok := props[ResourceTypeName]; !ok {
props[ResourceTypeName] = func(*RawXMLValue) (interface{}, error) {
return NewResourceType(), nil
}
}
if propfind.PropName != nil {
for xmlName, _ := range props {
emptyVal := NewRawXMLElement(xmlName, nil, nil)