mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 16:24:14 +00:00
caldav, carddav: displayname and desription are optional
Both the displayname and the description can be absent for both calendars and address books. If this is the case they should not show up in PROPFIND responses as empty string.
This commit is contained in:
parent
0ea114ec79
commit
ad1fe1c5a8
@ -533,9 +533,6 @@ func (b *backend) propFindCalendar(ctx context.Context, propfind *internal.PropF
|
|||||||
internal.ResourceTypeName: func(*internal.RawXMLValue) (interface{}, error) {
|
internal.ResourceTypeName: func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
return internal.NewResourceType(internal.CollectionName, calendarName), nil
|
return internal.NewResourceType(internal.CollectionName, calendarName), nil
|
||||||
},
|
},
|
||||||
internal.DisplayNameName: func(*internal.RawXMLValue) (interface{}, error) {
|
|
||||||
return &internal.DisplayName{Name: cal.Name}, nil
|
|
||||||
},
|
|
||||||
calendarDescriptionName: func(*internal.RawXMLValue) (interface{}, error) {
|
calendarDescriptionName: func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
return &calendarDescription{Description: cal.Description}, nil
|
return &calendarDescription{Description: cal.Description}, nil
|
||||||
},
|
},
|
||||||
@ -561,12 +558,16 @@ func (b *backend) propFindCalendar(ctx context.Context, propfind *internal.PropF
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cal.Name != "" {
|
||||||
|
props[internal.DisplayNameName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
|
return &internal.DisplayName{Name: cal.Name}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
if cal.Description != "" {
|
if cal.Description != "" {
|
||||||
props[calendarDescriptionName] = func(*internal.RawXMLValue) (interface{}, error) {
|
props[calendarDescriptionName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
return &calendarDescription{Description: cal.Description}, nil
|
return &calendarDescription{Description: cal.Description}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if cal.MaxResourceSize > 0 {
|
if cal.MaxResourceSize > 0 {
|
||||||
props[maxResourceSizeName] = func(*internal.RawXMLValue) (interface{}, error) {
|
props[maxResourceSizeName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
return &maxResourceSize{Size: cal.MaxResourceSize}, nil
|
return &maxResourceSize{Size: cal.MaxResourceSize}, nil
|
||||||
|
@ -499,12 +499,6 @@ func (b *backend) propFindAddressBook(ctx context.Context, propfind *internal.Pr
|
|||||||
internal.ResourceTypeName: func(*internal.RawXMLValue) (interface{}, error) {
|
internal.ResourceTypeName: func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
return internal.NewResourceType(internal.CollectionName, addressBookName), nil
|
return internal.NewResourceType(internal.CollectionName, addressBookName), nil
|
||||||
},
|
},
|
||||||
internal.DisplayNameName: func(*internal.RawXMLValue) (interface{}, error) {
|
|
||||||
return &internal.DisplayName{Name: ab.Name}, nil
|
|
||||||
},
|
|
||||||
addressBookDescriptionName: func(*internal.RawXMLValue) (interface{}, error) {
|
|
||||||
return &addressbookDescription{Description: ab.Description}, nil
|
|
||||||
},
|
|
||||||
supportedAddressDataName: func(*internal.RawXMLValue) (interface{}, error) {
|
supportedAddressDataName: func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
return &supportedAddressData{
|
return &supportedAddressData{
|
||||||
Types: []addressDataType{
|
Types: []addressDataType{
|
||||||
@ -515,6 +509,16 @@ func (b *backend) propFindAddressBook(ctx context.Context, propfind *internal.Pr
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ab.Name != "" {
|
||||||
|
props[internal.DisplayNameName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
|
return &internal.DisplayName{Name: ab.Name}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ab.Description != "" {
|
||||||
|
props[addressBookDescriptionName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
|
return &addressbookDescription{Description: ab.Description}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
if ab.MaxResourceSize > 0 {
|
if ab.MaxResourceSize > 0 {
|
||||||
props[maxResourceSizeName] = func(*internal.RawXMLValue) (interface{}, error) {
|
props[maxResourceSizeName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
return &maxResourceSize{Size: ab.MaxResourceSize}, nil
|
return &maxResourceSize{Size: ab.MaxResourceSize}, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user