From 8ea72ed5c9d9ffccd5b29c048f413d3bf9e6c773 Mon Sep 17 00:00:00 2001 From: P40b0s <103313854+P40b0s@users.noreply.github.com> Date: Thu, 16 Jun 2022 16:38:59 +0300 Subject: [PATCH] fix author if it have <> chars (#501) --- docx-core/src/reader/comment.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docx-core/src/reader/comment.rs b/docx-core/src/reader/comment.rs index 1f75e4d..46fe71b 100644 --- a/docx-core/src/reader/comment.rs +++ b/docx-core/src/reader/comment.rs @@ -4,6 +4,7 @@ use std::str::FromStr; use xml::attribute::OwnedAttribute; use xml::reader::{EventReader, XmlEvent}; +use crate::escape; use super::*; impl ElementReader for Comment { @@ -14,7 +15,7 @@ impl ElementReader for Comment { let id = usize::from_str(&read(attrs, "id").expect("should comment id exists."))?; let mut comment = Comment::new(id); if let Some(author) = read(attrs, "author") { - comment = comment.author(author); + comment = comment.author(escape::escape(author.as_str())); }; if let Some(date) = read(attrs, "date") { comment = comment.date(date);