diff --git a/caldav/server.go b/caldav/server.go index f69a0bd..24977b8 100644 --- a/caldav/server.go +++ b/caldav/server.go @@ -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 diff --git a/carddav/server.go b/carddav/server.go index 028e151..8ea7680 100644 --- a/carddav/server.go +++ b/carddav/server.go @@ -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