diff --git a/crates/jmap/src/calendar_event/set.rs b/crates/jmap/src/calendar_event/set.rs index 4e18888c..74b74119 100644 --- a/crates/jmap/src/calendar_event/set.rs +++ b/crates/jmap/src/calendar_event/set.rs @@ -38,7 +38,10 @@ use jmap_proto::{ use jmap_tools::{JsonPointerHandler, JsonPointerItem, Key, Map, Value}; use std::{borrow::Cow, str::FromStr}; use store::{ - ValueKey, ahash::AHashSet, roaring::RoaringBitmap, write::{AlignedBytes, Archive, BatchBuilder, now, serialize::rkyv_deserialize} + ValueKey, + ahash::AHashSet, + roaring::RoaringBitmap, + write::{AlignedBytes, Archive, BatchBuilder, now, serialize::rkyv_deserialize}, }; use trc::AddContext; use types::{ @@ -802,6 +805,29 @@ fn update_calendar_event<'x>( .with_property(property) .with_description("Invalid value.")); } + ( + property @ (JSCalendarProperty::Locations | JSCalendarProperty::Participants), + Value::Object(values), + ) => { + for (_, value) in values.iter() { + if let Some(values) = value + .as_object_and_get(&Key::Property(JSCalendarProperty::Links)) + .and_then(|v| v.as_object()) + { + for (_, value) in values.iter() { + if value.as_object().is_some_and(|v| { + v.keys() + .any(|k| matches!(k, Key::Property(JSCalendarProperty::BlobId))) + }) { + return Err(SetError::invalid_properties() + .with_property(property) + .with_description("blobIds in links is not supported.")); + } + } + } + } + entries.insert(property, Value::Object(values)); + } (property, value) => { if let (JSCalendarProperty::ShowWithoutTime, Value::Bool(set)) = (&property, &value) { diff --git a/crates/jmap/src/contact/set.rs b/crates/jmap/src/contact/set.rs index 110f022e..b4b8e416 100644 --- a/crates/jmap/src/contact/set.rs +++ b/crates/jmap/src/contact/set.rs @@ -17,7 +17,12 @@ use jmap_proto::{ types::state::State, }; use jmap_tools::{JsonPointerHandler, JsonPointerItem, Key, Value}; -use store::{ValueKey, ahash::AHashSet, roaring::RoaringBitmap, write::{AlignedBytes, Archive, BatchBuilder}}; +use store::{ + ValueKey, + ahash::AHashSet, + roaring::RoaringBitmap, + write::{AlignedBytes, Archive, BatchBuilder}, +}; use trc::AddContext; use types::{ acl::Acl, @@ -468,6 +473,19 @@ fn update_contact_card<'x>( } entries = js_contact.0.as_object_mut().unwrap(); } + (JSContactProperty::Media, Value::Object(media)) => { + for (_, value) in media.iter() { + if value.as_object().is_some_and(|v| { + v.keys() + .any(|k| matches!(k, Key::Property(JSContactProperty::BlobId))) + }) { + return Err(SetError::invalid_properties() + .with_property(JSContactProperty::Media) + .with_description("blobIds in media is not supported.")); + } + } + entries.insert(JSContactProperty::Media, Value::Object(media)); + } (property, value) => { entries.insert(property, value); }