patch Campfire events with no location

This commit is contained in:
_ 2025-09-11 03:35:59 +00:00
parent 9dba0779eb
commit b320605f26
3 changed files with 15 additions and 11 deletions

View file

@ -27,7 +27,8 @@ struct Event {
_end_time: Option<String>, _end_time: Option<String>,
#[serde(alias = "eventName")] #[serde(alias = "eventName")]
event_name: String, event_name: String,
location: String, // Seen in test data where this can be missing
location: Option<String>,
#[serde(alias = "Id")] #[serde(alias = "Id")]
id: String, id: String,
#[serde(alias = "startDate")] #[serde(alias = "startDate")]
@ -95,7 +96,7 @@ impl Calendar {
Some(Ok(EventInstance { Some(Ok(EventInstance {
calendar_ui: self.config.ui.clone(), calendar_ui: self.config.ui.clone(),
dtstart, dtstart,
location: Some(ev.location.clone()), location: ev.location.clone(),
recurrence_id: None, recurrence_id: None,
summary: Some(ev.event_name.clone()), summary: Some(ev.event_name.clone()),
uid: Some(ev.id.clone()), uid: Some(ev.id.clone()),
@ -111,9 +112,10 @@ impl Calendar {
} }
pub(crate) fn read_from_config(config: Config) -> Result<Self> { pub(crate) fn read_from_config(config: Config) -> Result<Self> {
let path = &config.dl.file_path; let path = config.dl.file_path.clone();
let s = std::fs::read_to_string(path).with_context(|| format!("Couldn't read {path:?}"))?; let s =
Self::read_from_str(config, &s) std::fs::read_to_string(&path).with_context(|| format!("Couldn't read {path:?}"))?;
Self::read_from_str(config, &s).with_context(|| format!("Couldn't parse {path:?}"))
} }
} }

View file

@ -95,9 +95,10 @@ impl Calendar {
} }
pub(crate) fn read_from_config(config: Config) -> Result<Self> { pub(crate) fn read_from_config(config: Config) -> Result<Self> {
let path = &config.dl.file_path; let path = config.dl.file_path.clone();
let s = std::fs::read_to_string(path).with_context(|| format!("Couldn't read {path:?}"))?; let s =
Self::read_from_str(config, &s) std::fs::read_to_string(&path).with_context(|| format!("Couldn't read {path:?}"))?;
Self::read_from_str(config, &s).with_context(|| format!("Couldn't parse {path:?}"))
} }
} }

View file

@ -267,8 +267,9 @@ impl Calendar {
} }
pub(crate) fn read_from_config(config: Config) -> Result<Self> { pub(crate) fn read_from_config(config: Config) -> Result<Self> {
let path = &config.dl.file_path; let path = config.dl.file_path.clone();
let s = std::fs::read_to_string(path).with_context(|| format!("Couldn't read {path:?}"))?; let s =
Self::read_from_str(config, &s) std::fs::read_to_string(&path).with_context(|| format!("Couldn't read {path:?}"))?;
Self::read_from_str(config, &s).with_context(|| format!("Couldn't parse {path:?}"))
} }
} }