diff --git a/crates/dav/src/methods/propfind.rs b/crates/dav/src/methods/propfind.rs index 3c2ab35..7f1c3be 100644 --- a/crates/dav/src/methods/propfind.rs +++ b/crates/dav/src/methods/propfind.rs @@ -44,7 +44,13 @@ pub async fn route_propfind prefix: Data, auth: AuthInfoExtractor, depth: Depth, -) -> Result::Prop>, String>, R::Error> { +) -> Result< + MultistatusElement< + PropstatWrapper<::Prop>, + PropstatWrapper<::Prop>, + >, + R::Error, +> { debug!("{body}"); let auth_info = auth.inner; let prefix = prefix.0.to_owned(); @@ -86,6 +92,7 @@ pub async fn route_propfind Ok(MultistatusElement { responses: vec![response], + member_responses, ..Default::default() }) } diff --git a/crates/dav/src/methods/proppatch.rs b/crates/dav/src/methods/proppatch.rs index 962dfb2..cfa64a8 100644 --- a/crates/dav/src/methods/proppatch.rs +++ b/crates/dav/src/methods/proppatch.rs @@ -151,6 +151,7 @@ pub async fn route_proppatch HandlePropfind for R { prop: TagList::from(props), status: format!("HTTP/1.1 {}", StatusCode::OK), })], + ..Default::default() }); } if props.contains(&"allprop") { @@ -155,6 +156,7 @@ impl HandlePropfind for R { Ok(ResponseElement { href: path, propstat: propstats, + ..Default::default() }) } } diff --git a/crates/dav/src/xml/multistatus.rs b/crates/dav/src/xml/multistatus.rs index 5b57a6d..f186ef7 100644 --- a/crates/dav/src/xml/multistatus.rs +++ b/crates/dav/src/xml/multistatus.rs @@ -36,9 +36,21 @@ pub enum PropstatWrapper { #[serde(rename_all = "kebab-case")] pub struct ResponseElement { pub href: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, pub propstat: Vec, } +impl Default for ResponseElement { + fn default() -> Self { + Self { + href: String::new(), + status: None, + propstat: vec![], + } + } +} + // RFC 2518 // // Extended by sync-token as specified in RFC 6578 @@ -55,6 +67,7 @@ pub struct MultistatusElement { pub ns_caldav: &'static str, #[serde(rename = "@xmlns:IC")] pub ns_ical: &'static str, + #[serde(skip_serializing_if = "Option::is_none")] pub sync_token: Option, }