From c165e761be74953911c41c229ce45c700b1f30eb Mon Sep 17 00:00:00 2001 From: Lennart K <18233294+lennart-k@users.noreply.github.com> Date: Mon, 12 Jan 2026 14:04:11 +0100 Subject: [PATCH] update ical-rs --- Cargo.lock | 43 +++++++++---------- crates/caldav/src/calendar/methods/import.rs | 4 +- .../report/calendar_query/prop_filter.rs | 9 ++-- .../carddav/src/addressbook/methods/import.rs | 5 +-- .../report/addressbook_query/prop_filter.rs | 10 ++--- ...ion_tests__caldav__calendar__get_body.snap | 3 +- ...__caldav__calendar_import__0_get_body.snap | 2 +- ...__caldav__calendar_import__1_get_body.snap | 4 +- ...__carddav__addressbook__multiget_body.snap | 2 +- 9 files changed, 39 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 677f60b..4f6ad18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -477,9 +477,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.8.2" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d809780667f4410e7c41b07f52439b94d2bdf8528eeedc287fa38d3b7f95d82" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" [[package]] name = "basic-toml" @@ -1422,9 +1422,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "js-sys", @@ -1771,7 +1771,7 @@ dependencies = [ [[package]] name = "ical" version = "0.11.0" -source = "git+https://github.com/lennart-k/ical-rs?branch=dev#64c342e7258ba445dc91b47cd8e20e0ac8ffc417" +source = "git+https://github.com/lennart-k/ical-rs?branch=dev#28e982f928a73f5af13f1e59e28da419567bf93f" dependencies = [ "chrono", "chrono-tz", @@ -2242,7 +2242,7 @@ checksum = "51e219e79014df21a225b1860a479e2dcd7cbd9130f4defd4bd0e191ea31d67d" dependencies = [ "base64 0.22.1", "chrono", - "getrandom 0.2.16", + "getrandom 0.2.17", "http", "rand 0.8.5", "reqwest", @@ -2521,7 +2521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a2a4764cc1f8d961d802af27193c6f4f0124bd0e76e8393cf818e18880f0524" dependencies = [ "argon2", - "getrandom 0.2.16", + "getrandom 0.2.17", "password-hash", "pbkdf2", "rand_core 0.6.4", @@ -2847,9 +2847,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.14.1" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d" +checksum = "d2ea70524a2f82d518bce41317d0fae74151505651af45faf1ffbd6fd33f0568" dependencies = [ "bytes", "prost-derive", @@ -2857,9 +2857,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.14.1" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425" +checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" dependencies = [ "anyhow", "itertools 0.14.0", @@ -2994,7 +2994,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.17", ] [[package]] @@ -3160,7 +3160,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.16", + "getrandom 0.2.17", "libc", "untrusted", "windows-sys 0.52.0", @@ -3350,7 +3350,7 @@ dependencies = [ "serde", "sqlx", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", "tower", "tower-http", "tower-sessions", @@ -4494,9 +4494,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.10+spec-1.1.0" +version = "0.9.11+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0825052159284a1a8b4d6c0c86cbc801f2da5afd2b225fa548c72f2e74002f48" +checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46" dependencies = [ "indexmap 2.13.0", "serde_core", @@ -4781,16 +4781,13 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6e5658463dd88089aba75c7791e1d3120633b1bfde22478b28f625a9bb1b8e" +checksum = "1ac28f2d093c6c477eaa76b23525478f38de514fa9aeb1285738d4b97a9552fc" dependencies = [ "js-sys", "opentelemetry", - "opentelemetry_sdk", - "rustversion", "smallvec", - "thiserror 2.0.17", "tracing", "tracing-core", "tracing-log", @@ -5562,6 +5559,6 @@ dependencies = [ [[package]] name = "zmij" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc5a66a20078bf1251bde995aa2fdcc4b800c70b5d92dd2c62abc5c60f679f8" +checksum = "ac93432f5b761b22864c774aac244fa5c0fd877678a4c37ebf6cf42208f9c9ec" diff --git a/crates/caldav/src/calendar/methods/import.rs b/crates/caldav/src/calendar/methods/import.rs index 054b7ef..2a96efd 100644 --- a/crates/caldav/src/calendar/methods/import.rs +++ b/crates/caldav/src/calendar/methods/import.rs @@ -11,7 +11,7 @@ use rustical_ical::CalendarObjectType; use rustical_store::{ Calendar, CalendarMetadata, CalendarStore, SubscriptionStore, auth::Principal, }; -use std::{collections::HashMap, io::BufReader}; +use std::io::BufReader; use tracing::instrument; #[instrument(skip(resource_service))] @@ -50,7 +50,7 @@ pub async fn route_import( cal.remove_property("X-WR-CALDESC"); cal.remove_property("X-WR-CALCOLOR"); cal.remove_property("X-WR-TIMEZONE"); - let cal = cal.build(&HashMap::new()).unwrap(); + let cal = cal.build(None).unwrap(); // Make sure timezone is valid if let Some(timezone_id) = timezone_id.as_ref() { diff --git a/crates/caldav/src/calendar/methods/report/calendar_query/prop_filter.rs b/crates/caldav/src/calendar/methods/report/calendar_query/prop_filter.rs index 889d0ee..fe99f03 100644 --- a/crates/caldav/src/calendar/methods/report/calendar_query/prop_filter.rs +++ b/crates/caldav/src/calendar/methods/report/calendar_query/prop_filter.rs @@ -3,7 +3,6 @@ use ical::{parser::Component, property::ContentLine, types::CalDateTime}; use rustical_dav::xml::TextMatchElement; use rustical_ical::UtcDateTime; use rustical_xml::XmlDeserialize; -use std::collections::HashMap; #[derive(XmlDeserialize, Clone, Debug, PartialEq, Eq)] #[allow(dead_code)] @@ -27,7 +26,7 @@ impl PropFilterElement { pub fn match_property(&self, property: &ContentLine) -> bool { if let Some(TimeRangeElement { start, end }) = &self.time_range { // TODO: Respect timezones - let Ok(timestamp) = CalDateTime::parse_prop(property, &HashMap::default()) else { + let Ok(timestamp) = CalDateTime::parse_prop(property, None) else { return false; }; let timestamp = timestamp.utc(); @@ -62,13 +61,13 @@ impl PropFilterElement { } pub fn match_component(&self, comp: &impl Component) -> bool { - let properties = comp.get_named_properties(&self.name); + let mut properties = comp.get_named_properties(&self.name); if self.is_not_defined.is_some() { - return properties.is_empty(); + return properties.next().is_none(); } // The filter matches when one property instance matches // Example where this matters: We have multiple attendees and want to match one - properties.iter().any(|prop| self.match_property(prop)) + properties.any(|prop| self.match_property(prop)) } } diff --git a/crates/carddav/src/addressbook/methods/import.rs b/crates/carddav/src/addressbook/methods/import.rs index 82709e9..da3bcb0 100644 --- a/crates/carddav/src/addressbook/methods/import.rs +++ b/crates/carddav/src/addressbook/methods/import.rs @@ -1,5 +1,3 @@ -use std::{collections::HashMap, io::BufReader}; - use crate::Error; use crate::addressbook::AddressbookResourceService; use axum::{ @@ -12,6 +10,7 @@ use ical::{ property::ContentLine, }; use rustical_store::{Addressbook, AddressbookStore, SubscriptionStore, auth::Principal}; +use std::io::BufReader; use tracing::instrument; #[instrument(skip(resource_service))] @@ -38,7 +37,7 @@ pub async fn route_import( value: Some(uuid::Uuid::new_v4().to_string()), params: vec![].into(), }); - card = card_mut.build(&HashMap::new()).unwrap(); + card = card_mut.build(None).unwrap(); } // TODO: Make nicer let uid = card.get_uid().unwrap(); diff --git a/crates/carddav/src/addressbook/methods/report/addressbook_query/prop_filter.rs b/crates/carddav/src/addressbook/methods/report/addressbook_query/prop_filter.rs index eec0e96..b10b03c 100644 --- a/crates/carddav/src/addressbook/methods/report/addressbook_query/prop_filter.rs +++ b/crates/carddav/src/addressbook/methods/report/addressbook_query/prop_filter.rs @@ -56,22 +56,22 @@ impl PropFilterElement { } pub fn match_component(&self, comp: &impl PropFilterable) -> bool { - let properties = comp.get_named_properties(&self.name); + let mut properties = comp.get_named_properties(&self.name); if self.is_not_defined.is_some() { - return properties.is_empty(); + return properties.next().is_none(); } // The filter matches when one property instance matches - properties.iter().any(|prop| self.match_property(prop)) + properties.any(|prop| self.match_property(prop)) } } pub trait PropFilterable { - fn get_named_properties(&self, name: &str) -> Vec<&ContentLine>; + fn get_named_properties<'a>(&'a self, name: &'a str) -> impl Iterator; } impl PropFilterable for AddressObject { - fn get_named_properties(&self, name: &str) -> Vec<&ContentLine> { + fn get_named_properties<'a>(&'a self, name: &'a str) -> impl Iterator { self.get_vcard().get_named_properties(name) } } diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__get_body.snap b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__get_body.snap index d0fc17b..b336d9c 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__get_body.snap +++ b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar__get_body.snap @@ -4,9 +4,10 @@ expression: body --- BEGIN:VCALENDAR VERSION:2.0 +PRODID:RustiCal Export CALSCALE:GREGORIAN -PRODID:RustiCal X-WR-CALNAME:Calendar X-WR-CALDESC:Description +X-WR-CALCOLOR:#00FF00 X-WR-TIMEZONE:US/Eastern END:VCALENDAR diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__0_get_body.snap b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__0_get_body.snap index 7dc2838..c031a57 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__0_get_body.snap +++ b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__0_get_body.snap @@ -4,8 +4,8 @@ expression: body --- BEGIN:VCALENDAR VERSION:2.0 +PRODID:RustiCal Export CALSCALE:GREGORIAN -PRODID:RustiCal BEGIN:VEVENT UID:[UID] SUMMARY:One-off Meeting diff --git a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__1_get_body.snap b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__1_get_body.snap index 8b15580..2cdafb5 100644 --- a/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__1_get_body.snap +++ b/src/integration_tests/caldav/snapshots/rustical__integration_tests__caldav__calendar_import__1_get_body.snap @@ -4,8 +4,8 @@ expression: body --- BEGIN:VCALENDAR VERSION:2.0 +PRODID:RustiCal Export CALSCALE:GREGORIAN -PRODID:RustiCal BEGIN:VTIMEZONE LAST-MODIFIED:20040110T032845Z TZID:US/Eastern @@ -29,7 +29,7 @@ DTSTAMP:20060206T001102Z DTSTART;TZID=US/Eastern:20060102T100000 DURATION:PT1H SUMMARY:Event #1 -Description:Go Steelers! +DESCRIPTION:Go Steelers! UID:[UID] END:VEVENT BEGIN:VEVENT diff --git a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__multiget_body.snap b/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__multiget_body.snap index 147559f..11e19dd 100644 --- a/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__multiget_body.snap +++ b/src/integration_tests/carddav/snapshots/rustical__integration_tests__carddav__addressbook__multiget_body.snap @@ -8,7 +8,7 @@ expression: body /carddav/principal/user/contacts/newcard.vcf - "24835b6c11816c864f9edadd4c7c296234c643892afcbbc5fbf5c9b7ac935cf8" + "ea0bf4a2ce7ef84606a4cf9235776dbc11b3e7ce351ddf35f27cbc0088acca7e" BEGIN:VCARD VERSION:3.0 FN:Cyrus Daboo