From 18b620c50de64707196319643b8cd672d9ca86d9 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Sun, 25 May 2025 10:21:34 +0200 Subject: [PATCH] Return correct DAV namespace for missing properties (closes #1545) --- README.md | 2 +- crates/dav-proto/src/responses/property.rs | 12 ++++++++++++ crates/dav/src/common/propfind.rs | 3 +++ crates/dav/src/principal/propfind.rs | 2 ++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b693d460..a8fdff8d 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Key features: - **Spam** and **Phishing** built-in filter: - Comprehensive set of filtering **rules** on par with popular solutions. - LLM-driven spam filtering and message analysis. - - Statistical **spam classifier** with automatic training capabilities. + - Statistical **spam classifier** with automatic training capabilities and address book integration. - DNS Blocklists (**DNSBLs**) checking of IP addresses, domains, and hashes. - Collaborative digest-based spam filtering with **Pyzor**. - **Phishing** protection against homographic URL attacks, sender spoofing and other techniques. diff --git a/crates/dav-proto/src/responses/property.rs b/crates/dav-proto/src/responses/property.rs index 947be158..d7e77e5b 100644 --- a/crates/dav-proto/src/responses/property.rs +++ b/crates/dav-proto/src/responses/property.rs @@ -226,6 +226,18 @@ impl DavProperty { None, ) } + + pub fn namespace(&self) -> Namespace { + match self { + DavProperty::WebDav(WebDavProperty::GetCTag) => Namespace::CalendarServer, + DavProperty::CardDav(_) + | DavProperty::Principal(PrincipalProperty::AddressbookHomeSet) => Namespace::CardDav, + DavProperty::CalDav(_) | DavProperty::Principal(PrincipalProperty::CalendarHomeSet) => { + Namespace::CalDav + } + _ => Namespace::Dav, + } + } } impl AsRef for DavProperty { diff --git a/crates/dav/src/common/propfind.rs b/crates/dav/src/common/propfind.rs index 170f8969..69757954 100644 --- a/crates/dav/src/common/propfind.rs +++ b/crates/dav/src/common/propfind.rs @@ -298,6 +298,7 @@ impl PropFindRequestHandler for Server { fields.push(DavPropertyValue::new(prop.clone(), reports)); } _ => { + response.set_namespace(prop.namespace()); fields_not_found.push(DavPropertyValue::empty(prop.clone())); } } @@ -1330,6 +1331,7 @@ impl PropFindRequestHandler for Server { _ => { if !skip_not_found { + response.set_namespace(property.namespace()); fields_not_found.push(DavPropertyValue::empty(property.clone())); } } @@ -1337,6 +1339,7 @@ impl PropFindRequestHandler for Server { property => { if !skip_not_found { + response.set_namespace(property.namespace()); fields_not_found.push(DavPropertyValue::empty(property.clone())); } } diff --git a/crates/dav/src/principal/propfind.rs b/crates/dav/src/principal/propfind.rs index 82348017..60676dfe 100644 --- a/crates/dav/src/principal/propfind.rs +++ b/crates/dav/src/principal/propfind.rs @@ -228,6 +228,7 @@ impl PrincipalPropFind for Server { )); } _ => { + response.set_namespace(property.namespace()); fields_not_found.push(DavPropertyValue::empty(property.clone())); } }, @@ -275,6 +276,7 @@ impl PrincipalPropFind for Server { } }, _ => { + response.set_namespace(property.namespace()); fields_not_found.push(DavPropertyValue::empty(property.clone())); } }