From 9206fa8bab30ddfc484f4ede4ff1bc1ebc893851 Mon Sep 17 00:00:00 2001 From: Camille Moussu <66134347+Eriikah@users.noreply.github.com> Date: Wed, 8 Oct 2025 11:28:55 +0200 Subject: [PATCH] [#196] added check to prevent error when getting visibility when it's missing (#198) Co-authored-by: Camille Moussu --- src/components/Calendar/utils/calendarUtils.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/Calendar/utils/calendarUtils.ts b/src/components/Calendar/utils/calendarUtils.ts index cf947df..a9270ac 100644 --- a/src/components/Calendar/utils/calendarUtils.ts +++ b/src/components/Calendar/utils/calendarUtils.ts @@ -143,16 +143,16 @@ interface AclEntry { export function getCalendarVisibility(acl: AclEntry[]): "private" | "public" { let hasRead = false; let hasFreeBusy = false; + if (acl) { + for (const entry of acl) { + if (entry.principal !== "{DAV:}authenticated") continue; - for (const entry of acl) { - if (entry.principal !== "{DAV:}authenticated") continue; - - if (entry.privilege === "{DAV:}read") { - hasRead = true; - break; // highest visibility, can stop + if (entry.privilege === "{DAV:}read") { + hasRead = true; + break; // highest visibility, can stop + } } } - if (hasRead) return "public"; return "private"; }