From c76a6606234d0ef367a8a7c1ff5e7719aee52a0f Mon Sep 17 00:00:00 2001 From: mdecimus Date: Sun, 25 May 2025 17:14:47 +0200 Subject: [PATCH] Extract iCal UIDs from core components only --- crates/dav/src/calendar/update.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/dav/src/calendar/update.rs b/crates/dav/src/calendar/update.rs index d494fef6..92d66ab6 100644 --- a/crates/dav/src/calendar/update.rs +++ b/crates/dav/src/calendar/update.rs @@ -278,7 +278,7 @@ impl CalendarUpdateRequestHandler for Server { fn validate_ical(ical: &ICalendar) -> crate::Result<&str> { // Validate UIDs - let uids = ical.uids().collect::>(); + let mut uids = HashSet::with_capacity(1); // Validate component types let mut types: [u8; 5] = [0; 5]; @@ -286,18 +286,33 @@ fn validate_ical(ical: &ICalendar) -> crate::Result<&str> { match comp.component_type { ICalendarComponentType::VEvent => { types[0] += 1; + if let Some(uid) = comp.uid() { + uids.insert(uid); + } } ICalendarComponentType::VTodo => { types[1] += 1; + if let Some(uid) = comp.uid() { + uids.insert(uid); + } } ICalendarComponentType::VJournal => { types[2] += 1; + if let Some(uid) = comp.uid() { + uids.insert(uid); + } } ICalendarComponentType::VFreebusy => { types[3] += 1; + if let Some(uid) = comp.uid() { + uids.insert(uid); + } } ICalendarComponentType::VAvailability => { types[4] += 1; + if let Some(uid) = comp.uid() { + uids.insert(uid); + } } _ => {} }