aboutsummaryrefslogtreecommitdiff
path: root/aero-dav/src
diff options
context:
space:
mode:
Diffstat (limited to 'aero-dav/src')
-rw-r--r--aero-dav/src/caldecoder.rs11
-rw-r--r--aero-dav/src/xml.rs6
2 files changed, 16 insertions, 1 deletions
diff --git a/aero-dav/src/caldecoder.rs b/aero-dav/src/caldecoder.rs
index 02991c2..6bc911f 100644
--- a/aero-dav/src/caldecoder.rs
+++ b/aero-dav/src/caldecoder.rs
@@ -974,6 +974,17 @@ mod tests {
}
#[tokio::test]
+ async fn simple_comp_filter() {
+ let expected = CompFilter {
+ name: Component::VEvent,
+ additional_rules: None,
+ };
+ let src = r#"<C:comp-filter name="VEVENT" xmlns:C="urn:ietf:params:xml:ns:caldav" />"#;
+ let got = deserialize::<CompFilter>(src).await;
+ assert_eq!(got, expected);
+ }
+
+ #[tokio::test]
async fn basic_mkcalendar() {
let expected = MkCalendar(dav::Set(dav::PropValue(vec![dav::Property::DisplayName(
"Lisa's Events".into(),
diff --git a/aero-dav/src/xml.rs b/aero-dav/src/xml.rs
index c89f531..e59f136 100644
--- a/aero-dav/src/xml.rs
+++ b/aero-dav/src/xml.rs
@@ -229,7 +229,10 @@ impl<T: IRead> Reader<T> {
}
pub async fn maybe_find<N: Node<N>>(&mut self) -> Result<Option<N>, ParsingError> {
- self.ensure_parent_has_child()?;
+ // We can't find anything inside a self-closed tag
+ if !self.parent_has_child() {
+ return Ok(None);
+ }
loop {
// Try parse
@@ -238,6 +241,7 @@ impl<T: IRead> Reader<T> {
otherwise => return otherwise.map(Some),
}
+ // Skip or stop
match self.peek() {
Event::End(_) => return Ok(None),
_ => self.skip().await?,