fix author if it have <> chars (#501)

main
P40b0s 2022-06-16 16:38:59 +03:00 committed by GitHub
parent be3e5a9860
commit 8ea72ed5c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ use std::str::FromStr;
use xml::attribute::OwnedAttribute; use xml::attribute::OwnedAttribute;
use xml::reader::{EventReader, XmlEvent}; use xml::reader::{EventReader, XmlEvent};
use crate::escape;
use super::*; use super::*;
impl ElementReader for Comment { 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 id = usize::from_str(&read(attrs, "id").expect("should comment id exists."))?;
let mut comment = Comment::new(id); let mut comment = Comment::new(id);
if let Some(author) = read(attrs, "author") { 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") { if let Some(date) = read(attrs, "date") {
comment = comment.date(date); comment = comment.date(date);