Re-implement calendar export

This commit is contained in:
Lennart K
2026-01-08 15:36:02 +01:00
parent 5639127782
commit 977fd75500
7 changed files with 82 additions and 86 deletions

View File

@@ -4,6 +4,7 @@ use super::prop::{
};
use crate::Error;
use derive_more::derive::{From, Into};
use ical::generator::Emitter;
use rustical_dav::{
extensions::CommonPropertiesExtension,
privileges::UserPrivilegeSet,
@@ -53,15 +54,18 @@ impl Resource for CalendarObjectResource {
CalendarObjectProp::Getetag(self.object.get_etag())
}
CalendarObjectPropName::CalendarData(CalendarData { expand, .. }) => {
CalendarObjectProp::CalendarData(if let Some(expand) = expand.as_ref() {
todo!()
// self.object.get_inner().expand_recurrence(
// Some(expand.start.to_utc()),
// Some(expand.end.to_utc()),
// )
} else {
self.object.get_ics().to_owned()
})
CalendarObjectProp::CalendarData(expand.as_ref().map_or_else(
|| self.object.get_ics().to_owned(),
|expand| {
self.object
.get_inner()
.expand_recurrence(
Some(expand.start.to_utc()),
Some(expand.end.to_utc()),
)
.generate()
},
))
}
CalendarObjectPropName::Getcontenttype => {
CalendarObjectProp::Getcontenttype("text/calendar;charset=utf-8")