mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 18:12:27 +00:00
@@ -11,7 +11,7 @@ use rustical_ical::CalendarObject;
|
||||
use rustical_store::CalendarStore;
|
||||
use rustical_store::auth::Principal;
|
||||
use std::str::FromStr;
|
||||
use tracing::{debug, error, instrument};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
#[instrument(skip(cal_store))]
|
||||
pub async fn get_event<C: CalendarStore>(
|
||||
@@ -78,18 +78,10 @@ pub async fn put_event<C: CalendarStore>(
|
||||
true
|
||||
};
|
||||
|
||||
let Ok(object) = CalendarObject::from_ics(body.clone()) else {
|
||||
let Ok(object) = CalendarObject::from_ics(body.clone(), Some(object_id)) else {
|
||||
debug!("invalid calendar data:\n{body}");
|
||||
return Err(Error::PreconditionFailed(Precondition::ValidCalendarData));
|
||||
};
|
||||
if object.get_uid() != object_id {
|
||||
error!(
|
||||
"Calendar object UID and file name not matching: UID={}, filename={}",
|
||||
object.get_uid(),
|
||||
object_id
|
||||
);
|
||||
return Err(Error::PreconditionFailed(Precondition::MatchingUid));
|
||||
}
|
||||
cal_store
|
||||
.put_object(principal, calendar_id, object, overwrite)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user