diff --git a/src/render.rs b/src/render.rs index 6585d3a..2e018ab 100644 --- a/src/render.rs +++ b/src/render.rs @@ -23,7 +23,7 @@ pub fn render_page(template: &str, config: &Config, entries: &[Entry], form_html pub fn render_form(config: &Config) -> String { let website_section = if config.enable_website_links { format!( - "\n\n\n", + "\n\n\n", config.label_website ) } else { @@ -32,7 +32,7 @@ pub fn render_form(config: &Config) -> String { let captcha_section = if config.enable_captcha { format!( - "\n\n\n", + "\n\n\n", config.captcha_question ) } else { @@ -176,11 +176,11 @@ pub fn render_form(config: &Config) -> String { format!( r#"{prompt}
"#, @@ -216,6 +216,7 @@ pub fn render_error_page(config: &Config, error: &str) -> String { } else { &config.style }; + let error = escape_html(error); format!( r#" @@ -280,8 +281,9 @@ fn render_entry(entry: &Entry, config: &Config) -> String { }; let drawing_html = if !entry.meta.drawing.is_empty() { format!( - "
"#));
+ assert!(html.contains(r#"
"#));
}
#[test]
@@ -557,7 +559,7 @@ mod tests {
let form = render_form(&config);
let html = render_page(DEFAULT_TEMPLATE, &config, &[entry], &form);
// Drawing renders regardless
- assert!(html.contains(r#"
"#));
+ assert!(html.contains(r#"
"#));
// But body HTML is escaped
assert!(html.contains("<script>"));
}