From 74e13aae46297ad1d565d4436ff63719f67e45c3 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Tue, 27 May 2025 14:09:54 +0200 Subject: [PATCH] Allow empty properties in PROPPATCH requests (#1580) --- CHANGELOG.md | 1 - crates/dav/src/calendar/proppatch.rs | 6 ++++++ crates/dav/src/card/proppatch.rs | 6 ++++++ crates/dav/src/file/proppatch.rs | 3 +++ tests/src/webdav/mkcol.rs | 6 +++++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 973ec2ca..3a559180 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,6 @@ If you are upgrading from v0.11.x, this version includes **breaking changes** to - Report list attempts to deserialize empty values (#1562) - Refresh expired FoundationDB transactions while retrieving large blobs (#1555). - ## [0.12.1] - 2025-05-26 If you are upgrading from v0.11.x, this version includes **breaking changes** to the database layout and requires a migration. Please read the [UPGRADING.md](https://github.com/stalwartlabs/stalwart/blob/main/UPGRADING.md) file for more information on how to upgrade from previous versions. diff --git a/crates/dav/src/calendar/proppatch.rs b/crates/dav/src/calendar/proppatch.rs index 26783bb1..4cc42ebd 100644 --- a/crates/dav/src/calendar/proppatch.rs +++ b/crates/dav/src/calendar/proppatch.rs @@ -362,6 +362,9 @@ impl CalendarPropPatchRequestHandler for Server { has_errors = true; } } + (_, DavValue::Null | DavValue::Components(_)) => { + items.insert_ok(property.property); + } _ => { items.insert_error_with_description( property.property, @@ -425,6 +428,9 @@ impl CalendarPropPatchRequestHandler for Server { has_errors = true; } } + (_, DavValue::Null) => { + items.insert_ok(property.property); + } _ => { items.insert_error_with_description( property.property, diff --git a/crates/dav/src/card/proppatch.rs b/crates/dav/src/card/proppatch.rs index 706792f0..ad934d6f 100644 --- a/crates/dav/src/card/proppatch.rs +++ b/crates/dav/src/card/proppatch.rs @@ -308,6 +308,9 @@ impl CardPropPatchRequestHandler for Server { has_errors = true; } } + (_, DavValue::Null) => { + items.insert_ok(property.property); + } _ => { items.insert_error_with_description( property.property, @@ -371,6 +374,9 @@ impl CardPropPatchRequestHandler for Server { has_errors = true; } } + (_, DavValue::Null) => { + items.insert_ok(property.property); + } _ => { items.insert_error_with_description( property.property, diff --git a/crates/dav/src/file/proppatch.rs b/crates/dav/src/file/proppatch.rs index 8091131e..662de2f7 100644 --- a/crates/dav/src/file/proppatch.rs +++ b/crates/dav/src/file/proppatch.rs @@ -242,6 +242,9 @@ impl FilePropPatchRequestHandler for Server { has_errors = true; } } + (_, DavValue::Null) => { + items.insert_ok(property.property); + } _ => { items.insert_error_with_description( property.property, diff --git a/tests/src/webdav/mkcol.rs b/tests/src/webdav/mkcol.rs index 9250bed8..9fa2a975 100644 --- a/tests/src/webdav/mkcol.rs +++ b/tests/src/webdav/mkcol.rs @@ -168,7 +168,11 @@ pub async fn test(test: &WebDavTest) { "MKCALENDAR", "/dav/cal/john/my-named-events2", [], - [("D:displayname", "Named Events 2")], + [ + ("D:displayname", "Named Events 2"), + ("A:calendar-description", ""), + ("A:supported-calendar-component-set", ""), + ], ) .await .with_status(StatusCode::CREATED)