From 855d23f0a4d22f49ff69c2f695ed58da51d40495 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Wed, 28 Aug 2024 00:47:55 +0200 Subject: [PATCH] Update quick-xml to 0.36 --- CHANGELOG.md | 2 ++ Cargo.toml | 2 +- src/channel.rs | 2 +- src/util.rs | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d286570f84..389fc5b556 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Update `quick-xml` to 0.36. [`#166`](https://github.com/rust-syndication/rss/pull/166) + ## 2.0.8 - 2024-05-11 - Update quick-xml and derive_builder dependencies. [`#162`](https://github.com/rust-syndication/rss/pull/162) diff --git a/Cargo.toml b/Cargo.toml index 6133620dd8..a4d164c20a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ validation = ["chrono", "chrono/std", "url", "mime"] with-serde = ["serde", "atom_syndication/with-serde"] [dependencies] -quick-xml = { version = "0.31", features = ["encoding"] } +quick-xml = { version = "0.36", features = ["encoding"] } atom_syndication = { version = "0.12", optional = true } chrono = { version = "0.4.31", optional = true, default-features = false, features = ["alloc"] } derive_builder = { version = "0.20", optional = true } diff --git a/src/channel.rs b/src/channel.rs index 0d12c4a3b2..ce61075fe6 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -1034,7 +1034,7 @@ impl Channel { /// ``` pub fn read_from(reader: R) -> Result { let mut reader = Reader::from_reader(reader); - reader.trim_text(true).expand_empty_elements(true); + reader.config_mut().expand_empty_elements = true; let namespaces; let mut buf = Vec::new(); diff --git a/src/util.rs b/src/util.rs index 79daa38b23..4cd8ab387d 100644 --- a/src/util.rs +++ b/src/util.rs @@ -27,7 +27,7 @@ pub(crate) fn attr_value<'s, B: BufRead>( attr: &'s Attribute<'s>, reader: &Reader, ) -> Result, Error> { - let value = attr.decode_and_unescape_value(reader)?; + let value = attr.decode_and_unescape_value(reader.decoder())?; Ok(value) } @@ -58,5 +58,5 @@ pub fn element_text(reader: &mut Reader) -> Result buf.clear(); } - Ok(Some(content).filter(|c| !c.is_empty())) + Ok(Some(content.trim().to_owned()).filter(|c| !c.is_empty())) }