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}
- - + + {website_section} - - + + {captcha_section} {drawing_section}{voice_note_section}
"#, @@ -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!( - "", - escape_html(&entry.meta.drawing) + "\"Drawing", + escape_html(&entry.meta.drawing), + escape_html(&entry.meta.name) ) } else { String::new() @@ -545,7 +547,7 @@ mod tests { entry.meta.drawing = "2026-04-09-abc123.png".into(); let form = render_form(&config); let html = render_page(DEFAULT_TEMPLATE, &config, &[entry], &form); - assert!(html.contains(r#""#)); + assert!(html.contains(r#"Drawing by alice"#)); } #[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#"Drawing by alice"#)); // But body HTML is escaped assert!(html.contains("<script>")); }