diff --git a/Cargo.lock b/Cargo.lock index b0495d1..6c11339 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -865,9 +865,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" +checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" dependencies = [ "memchr", "serde", diff --git a/dxr/Cargo.toml b/dxr/Cargo.toml index 5524eab..abe2ef4 100644 --- a/dxr/Cargo.toml +++ b/dxr/Cargo.toml @@ -21,7 +21,7 @@ required-features = ["derive", "i8", "nil"] dxr_derive = { workspace = true, optional = true } base64 = "0.22" chrono = { version = "0.4.19", features = ["std"], default-features = false } -quick-xml = { version = "0.30", features = ["serialize"] } +quick-xml = { version = "0.31", features = ["serialize"] } serde = { version = "1.0.104", features = ["derive"] } thiserror = "1.0.30" diff --git a/dxr/src/values/ser_de.rs b/dxr/src/values/ser_de.rs index 7c73562..bd34dbb 100644 --- a/dxr/src/values/ser_de.rs +++ b/dxr/src/values/ser_de.rs @@ -93,7 +93,7 @@ pub(crate) mod base64 { /// `foo` (which are both valid XML-RPC). pub(crate) mod value { use serde::{ - de::{self, Deserializer, Visitor}, + de::{self, Deserializer, IgnoredAny, Visitor}, Deserialize, }; use std::fmt; @@ -129,6 +129,7 @@ pub(crate) mod value { "nil", ]; + #[derive(Debug)] enum Field { I4, #[cfg(feature = "i8")] @@ -187,7 +188,7 @@ pub(crate) mod value { } } - if let Some(key) = map.next_key()? { + let value = if let Some(key) = map.next_key::()? { match key { Field::I4 => { let value = map.next_value()?; @@ -233,11 +234,20 @@ pub(crate) mod value { Ok(Value::array(value)) }, #[cfg(feature = "nil")] - Field::Nil => Ok(Value::nil()), + Field::Nil => { + let _: IgnoredAny = map.next_value()?; + Ok(Value::nil()) + }, } } else { // - Ok(Value::string(String::new())) + return Ok(Value::string(String::new())); + }; + + if let Some(key) = map.next_key::()? { + Err(de::Error::custom(format!("Unexpected key: {:?}", key))) + } else { + value } } }