diff --git a/internal/caldav/backend.go b/internal/caldav/backend.go index 6fd9335..24d13d6 100644 --- a/internal/caldav/backend.go +++ b/internal/caldav/backend.go @@ -310,8 +310,12 @@ func (b *Backend) resolveCalendar(requester, localName string, requireWrite bool func (b *Backend) calendarMeta(owner, realName, localName string) caldav.Calendar { desc := fmt.Sprintf("%s's %s calendar", owner, realName) return caldav.Calendar{ - Path: calHomePath() + localName + "/", - Name: localName, + Path: calHomePath() + localName + "/", + // The displayed name is always the plain calendar name (never the + // "owner~name" synthetic local name used internally to keep a + // shared calendar's URL unique) — clients like DAVx5 show this as + // the calendar's label, and "alice~work" looked confusing there. + Name: realName, Description: desc, SupportedComponentSet: []string{"VEVENT", "VTODO", "VJOURNAL"}, MaxResourceSize: 10 * 1024 * 1024, // 10 MiB diff --git a/internal/caldav/backend_test.go b/internal/caldav/backend_test.go index 43d895c..3a74d39 100644 --- a/internal/caldav/backend_test.go +++ b/internal/caldav/backend_test.go @@ -90,14 +90,14 @@ func TestListCalendarsIncludesSharedCalendar(t *testing.T) { } var found bool - wantName := sharedCalendarName("alice", "work") + wantPath := calHomePath() + sharedCalendarName("alice", "work") + "/" for _, c := range cals { - if c.Name == wantName { + if c.Path == wantPath && c.Name == "work" { found = true } } if !found { - t.Errorf("shared calendar %q not found in ListCalendars result: %+v", wantName, cals) + t.Errorf("shared calendar with path %q and display name %q not found in ListCalendars result: %+v", wantPath, "work", cals) } }