kb10uy/shortstoryserver2

[s3wf2-cli] リンクのエスケープ漏れ

Closed this issue · 0 comments

let href = parameters
.first()
.map(|p| {
let children = p.unwrap_parameter();
if let Some(ElementNode::Text(url)) = children.first() {
Ok(url)
} else {
Err(Error::new(
ErrorKind::InvalidData,
HtmlEmitterError::InvalidParameter(
"Only a plain text content is valid for link target",
),
))
}
})
.ok_or_else(|| {
Error::new(
ErrorKind::Other,
HtmlEmitterError::InvalidParameter("Link URL needed"),
)
})??;
write!(writer, "<a href=\"{}\">", href)?;

> echo '[link{"><script></script>}test]' | .\target\debug\s3wf2-cli.exe format -t html
<style>
</style>
<p>
<a href=""><script></script>">test</a>
</p>