Add truncation for automatically derived timezones

This commit is contained in:
Lennart
2026-01-24 22:48:08 +01:00
parent bb0484ac4a
commit 246a1aa738
5 changed files with 9 additions and 9 deletions

4
Cargo.lock generated
View File

@@ -567,9 +567,9 @@ checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
[[package]] [[package]]
name = "caldata" name = "caldata"
version = "0.13.1" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5549ae654c8e80ff922297ad06c49be64668cf947cb6ce45a2069985d21a2135" checksum = "f36de4a8034d98c95e7fe874b828272d823cfbd68e9571fe7bf6c419e852cbe2"
dependencies = [ dependencies = [
"chrono", "chrono",
"chrono-tz", "chrono-tz",

View File

@@ -107,7 +107,7 @@ strum = "0.27"
strum_macros = "0.27" strum_macros = "0.27"
serde_json = { version = "1.0", features = ["raw_value"] } serde_json = { version = "1.0", features = ["raw_value"] }
sqlx-sqlite = { version = "0.8", features = ["bundled"] } sqlx-sqlite = { version = "0.8", features = ["bundled"] }
caldata = { version = "0.13.0", features = ["chrono-tz", "vtimezones-rs"] } caldata = { version = "0.14.0", features = ["chrono-tz", "vtimezones-rs"] }
toml = "0.9" toml = "0.9"
tower = "0.5" tower = "0.5"
tower-http = { version = "0.6", features = [ tower-http = { version = "0.6", features = [

View File

@@ -4,8 +4,8 @@ use axum::{
extract::{Path, State}, extract::{Path, State},
response::{IntoResponse, Response}, response::{IntoResponse, Response},
}; };
use caldata::IcalParser;
use caldata::component::{Component, ComponentMut}; use caldata::component::{Component, ComponentMut};
use caldata::{IcalParser, parser::ParserOptions};
use http::StatusCode; use http::StatusCode;
use rustical_dav::header::Overwrite; use rustical_dav::header::Overwrite;
use rustical_ical::CalendarObjectType; use rustical_ical::CalendarObjectType;
@@ -50,7 +50,7 @@ pub async fn route_import<C: CalendarStore, S: SubscriptionStore>(
cal.remove_property("X-WR-CALDESC"); cal.remove_property("X-WR-CALDESC");
cal.remove_property("X-WR-CALCOLOR"); cal.remove_property("X-WR-CALCOLOR");
cal.remove_property("X-WR-TIMEZONE"); cal.remove_property("X-WR-TIMEZONE");
let cal = cal.build(None).unwrap(); let cal = cal.build(&ParserOptions::default(), None).unwrap();
// Make sure timezone is valid // Make sure timezone is valid
if let Some(timezone_id) = timezone_id.as_ref() { if let Some(timezone_id) = timezone_id.as_ref() {

View File

@@ -7,7 +7,7 @@ use axum::{
use caldata::{ use caldata::{
VcardParser, VcardParser,
component::{Component, ComponentMut}, component::{Component, ComponentMut},
parser::ContentLine, parser::{ContentLine, ParserOptions},
}; };
use http::StatusCode; use http::StatusCode;
use rustical_store::{Addressbook, AddressbookStore, SubscriptionStore, auth::Principal}; use rustical_store::{Addressbook, AddressbookStore, SubscriptionStore, auth::Principal};
@@ -37,7 +37,7 @@ pub async fn route_import<AS: AddressbookStore, S: SubscriptionStore>(
value: Some(uuid::Uuid::new_v4().to_string()), value: Some(uuid::Uuid::new_v4().to_string()),
params: vec![].into(), params: vec![].into(),
}); });
card = card_mut.build(None).unwrap(); card = card_mut.build(&ParserOptions::default(), None).unwrap();
} }
// TODO: Make nicer // TODO: Make nicer
let uid = card.get_uid().unwrap(); let uid = card.get_uid().unwrap();

View File

@@ -6,7 +6,7 @@ use caldata::{
IcalEventBuilder, VcardContact, IcalEventBuilder, VcardContact,
}, },
generator::Emitter, generator::Emitter,
parser::ContentLine, parser::{ContentLine, ParserOptions},
property::{ property::{
Calscale, IcalCALSCALEProperty, IcalDTENDProperty, IcalDTSTAMPProperty, Calscale, IcalCALSCALEProperty, IcalDTENDProperty, IcalDTSTAMPProperty,
IcalDTSTARTProperty, IcalPRODIDProperty, IcalRRULEProperty, IcalSUMMARYProperty, IcalDTSTARTProperty, IcalPRODIDProperty, IcalRRULEProperty, IcalSUMMARYProperty,
@@ -136,7 +136,7 @@ impl AddressObject {
inner: Some(CalendarInnerDataBuilder::Event(vec![event])), inner: Some(CalendarInnerDataBuilder::Event(vec![event])),
vtimezones: BTreeMap::default(), vtimezones: BTreeMap::default(),
} }
.build(None)? .build(&ParserOptions::default(), None)?
.into(), .into(),
)) ))
} }