From 69e788b363ec18ddec263bb08adc077e6b19fec1 Mon Sep 17 00:00:00 2001 From: Lennart <18233294+lennart-k@users.noreply.github.com> Date: Sun, 31 Aug 2025 12:40:20 +0200 Subject: [PATCH] store: prevent objects from being commited to subscription calendar --- crates/store_sqlite/src/calendar_store.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/store_sqlite/src/calendar_store.rs b/crates/store_sqlite/src/calendar_store.rs index 76615be..8127913 100644 --- a/crates/store_sqlite/src/calendar_store.rs +++ b/crates/store_sqlite/src/calendar_store.rs @@ -353,7 +353,6 @@ impl SqliteCalendarStore { object: CalendarObject, overwrite: bool, ) -> Result<(), Error> { - // TODO: Prevent objects from being commited to a subscription calendar let (object_id, ics) = (object.get_id(), object.get_ics()); let first_occurence = object @@ -669,11 +668,16 @@ impl CalendarStore for SqliteCalendarStore { object: CalendarObject, overwrite: bool, ) -> Result<(), Error> { - // TODO: Prevent objects from being commited to a subscription calendar let mut tx = self.db.begin().await.map_err(crate::Error::from)?; let object_id = object.get_id().to_owned(); + let calendar = Self::_get_calendar(&mut *tx, &principal, &cal_id, true).await?; + if calendar.subscription_url.is_some() { + // We cannot commit an object to a subscription calendar + return Err(Error::ReadOnly); + } + Self::_put_object( &mut *tx, principal.to_owned(),