dav: Add namespace to propname

This commit is contained in:
Lennart
2025-05-10 13:13:51 +02:00
parent 37eb6df64a
commit 8f69bc839a
5 changed files with 33 additions and 18 deletions

View File

@@ -43,13 +43,15 @@ pub(crate) async fn route_propfind<R: ResourceService>(
}
};
dbg!(&propfind);
// TODO: respect namespaces?
let props = match &propfind.prop {
PropfindType::Allprop => vec!["allprop"],
PropfindType::Propname => vec!["propname"],
PropfindType::Prop(PropElement(prop_tags)) => prop_tags
.iter()
.map(|propname| propname.0.as_str())
.map(|propname| propname.name.as_str())
.collect(),
};

View File

@@ -12,7 +12,12 @@ pub struct PropfindElement {
pub struct PropElement<PN: XmlDeserialize = Propname>(#[xml(ty = "untagged", flatten)] pub Vec<PN>);
#[derive(Debug, Clone, XmlDeserialize, PartialEq)]
pub struct Propname(#[xml(ty = "tag_name")] pub String);
pub struct Propname {
#[xml(ty = "namespace")]
pub ns: Option<String>,
#[xml(ty = "tag_name")]
pub name: String,
}
#[derive(Debug, Clone, XmlDeserialize, PartialEq)]
pub enum PropfindType<PN: XmlDeserialize = Propname> {

View File

@@ -54,8 +54,14 @@ fn propfind_prop() {
propfind,
PropfindElement {
prop: PropfindType::Prop(PropElement(vec![
Propname("displayname".to_owned()),
Propname("color".to_owned()),
Propname {
name: "displayname".to_owned(),
ns: Some("DAV:".to_owned())
},
Propname {
name: "color".to_owned(),
ns: Some("DAV:".to_owned())
},
]))
}
);