mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
ical: Work on calendar object data structure
This commit is contained in:
@@ -22,7 +22,17 @@ impl TryFrom<CalendarObjectRow> for CalendarObject {
|
||||
type Error = rustical_store::Error;
|
||||
|
||||
fn try_from(value: CalendarObjectRow) -> Result<Self, Self::Error> {
|
||||
Ok(CalendarObject::from_ics(value.id, value.ics)?)
|
||||
let object = CalendarObject::from_ics(value.ics)?;
|
||||
if object.get_id() != value.id {
|
||||
return Err(rustical_store::Error::IcalError(
|
||||
rustical_ical::Error::InvalidData(format!(
|
||||
"object_id={} and UID={} don't match",
|
||||
object.get_id(),
|
||||
value.id
|
||||
)),
|
||||
));
|
||||
}
|
||||
Ok(object)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user