html: escape img src values

This commit is contained in:
Noah Hellman 2023-03-12 17:02:42 +01:00
parent 5768b24907
commit fc374be56c

View file

@ -361,11 +361,11 @@ impl<'s, I: Iterator<Item = Event<'s>>, W: std::fmt::Write> Writer<'s, I, W> {
Container::Link(..) => self.out.write_str("</a>")?, Container::Link(..) => self.out.write_str("</a>")?,
Container::Image(src, ..) => { Container::Image(src, ..) => {
self.text_only = false; self.text_only = false;
if src.is_empty() { if !src.is_empty() {
self.out.write_str(r#"">"#)?; self.out.write_str(r#"" src=""#)?;
} else { self.write_attr(&src)?;
write!(self.out, r#"" src="{}">"#, src)?;
} }
self.out.write_str(r#"">"#)?;
} }
Container::Verbatim => self.out.write_str("</code>")?, Container::Verbatim => self.out.write_str("</code>")?,
Container::Math { display } => { Container::Math { display } => {