From 65cd24a19246e362f35a41ff85a4cef1bd5b5604 Mon Sep 17 00:00:00 2001 From: arnef Date: Thu, 20 Aug 2026 10:09:41 +0200 Subject: [PATCH] Show plain calendar name for shared calendars, drop ~owner prefix DAVx5/CalDAV clients displayed a shared calendar's DAV:displayname as "alice~work" (the synthetic owner~name local identifier nidus uses internally to keep a shared calendar's URL unique per subscriber). That internal name is still needed for routing (it's still what appears in the calendar's URL path), but there's no reason to show it to the end user as the calendar's label. calendarMeta() now always sets caldav.Calendar.Name to the plain calendar name (e.g. "work"), while Path still uses the "owner~name" local name. The web UI already showed the plain name via a separate "shared by " entry, so it's unaffected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- internal/caldav/backend.go | 8 ++++++-- internal/caldav/backend_test.go | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) 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) } }