mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 08:14:15 +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) {
|
||||
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) {
|
||||
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 != "" {
|
||||
props[calendarDescriptionName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||
return &calendarDescription{Description: cal.Description}, nil
|
||||
}
|
||||
}
|
||||
|
||||
if cal.MaxResourceSize > 0 {
|
||||
props[maxResourceSizeName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||
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) {
|
||||
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) {
|
||||
return &supportedAddressData{
|
||||
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 {
|
||||
props[maxResourceSizeName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||
return &maxResourceSize{Size: ab.MaxResourceSize}, nil
|
||||
|
Loading…
Reference in New Issue
Block a user