From b3fd99673e635e5384c4fdd5e254ad0625e23298 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Sun, 1 Jun 2025 16:33:15 +0200 Subject: [PATCH] WebDAV: Fix dead property updates (closes #1611) --- crates/dav-proto/src/requests/mod.rs | 2 +- crates/dav/src/common/mod.rs | 6 +++--- tests/src/webdav/prop.rs | 14 +++++++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/crates/dav-proto/src/requests/mod.rs b/crates/dav-proto/src/requests/mod.rs index 0b902f2f..bf9da037 100644 --- a/crates/dav-proto/src/requests/mod.rs +++ b/crates/dav-proto/src/requests/mod.rs @@ -61,7 +61,7 @@ impl DeadProperty { let mut remove = false; self.0.retain(|item| match item { DeadPropertyTag::ElementStart(tag) => { - if depth == 0 && !remove && tag == element { + if depth == 0 && !remove && tag.name == element.name { remove = true; } depth += 1; diff --git a/crates/dav/src/common/mod.rs b/crates/dav/src/common/mod.rs index dbfb9a08..73e5ce2c 100644 --- a/crates/dav/src/common/mod.rs +++ b/crates/dav/src/common/mod.rs @@ -92,7 +92,7 @@ pub(crate) enum DavQueryFilter { pub(crate) trait ETag { fn etag(&self) -> String; - fn ctag(&self) -> String; + //fn ctag(&self) -> String; } pub(crate) trait ExtractETag { @@ -104,9 +104,9 @@ impl ETag for Archive { format!("\"{}\"", self.version.hash().unwrap_or_default()) } - fn ctag(&self) -> String { + /*fn ctag(&self) -> String { format!("\"{}\"", self.version.change_id().unwrap_or_default()) - } + }*/ } impl ExtractETag for BatchBuilder { diff --git a/tests/src/webdav/prop.rs b/tests/src/webdav/prop.rs index 550eef8f..36fa9c56 100644 --- a/tests/src/webdav/prop.rs +++ b/tests/src/webdav/prop.rs @@ -496,13 +496,25 @@ pub async fn test(test: &WebDavTest) { ( DavProperty::DeadProperty(DeadElementTag::new( "my-dead-element".to_string(), - Some("xmlns=\"http://example.com/ns/\"".to_string()), + Some("xmlns=\"http://example.com/ns/\" prop=\"abc\"".to_string()), )), "this is a dead but exciting element", ), ], ) .await; + client + .patch_and_check( + path, + [( + DavProperty::DeadProperty(DeadElementTag::new( + "my-dead-element".to_string(), + Some("xmlns=\"http://example.com/ns/\" prop=\"xyz\"".to_string()), + )), + "this is a modified dead but exciting element", + )], + ) + .await; // Test 13: PROPPATCH remove on DAV properties let mut props = vec![