Skip to content

Commit

Permalink
Fix prop parsing in PROPPATCH
Browse files Browse the repository at this point in the history
  • Loading branch information
lennart-k committed Nov 4, 2024
1 parent 0cf6e5c commit 4da0ca3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/dav/src/methods/proppatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ pub async fn route_proppatch<R: ResourceService>(
prop: PropertyElement { prop },
}) => {
if prop.invalid_property() {
props_not_found.push(propname);
if <R::Resource as Resource>::list_all_props().contains(&propname.as_str()) {
// This happens in following cases:
// - read-only properties with #[serde(skip_deserializing)]
// - for read-only properties from extensions
props_conflict.push(propname)
} else {
props_not_found.push(propname);
}
continue;
}
match resource.set_prop(prop) {
Expand Down
11 changes: 11 additions & 0 deletions crates/dav/src/resource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ pub trait Resource: Clone + 'static {
Self::PropName::VARIANTS
}

fn list_all_props() -> Vec<&'static str> {
let mut props = Self::list_props().to_vec();
props.extend(
Self::list_extensions()
.into_iter()
.map(|ext| ext.list_props().to_vec())
.concat(),
);
props
}

fn get_prop(
&self,
rmap: &ResourceMap,
Expand Down

0 comments on commit 4da0ca3

Please sign in to comment.