From a06f380b67a2f0d92dea08afe7843609e1497ee1 Mon Sep 17 00:00:00 2001 From: lew Date: Fri, 10 Apr 2026 15:33:57 +0100 Subject: [PATCH 1/3] fix: label-for on form elements --- src/render.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/render.rs b/src/render.rs index 6585d3a..da98837 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}
"#, From a1ddbba66050f9d94eb4d9d5544d1160dfef8233 Mon Sep 17 00:00:00 2001 From: lew Date: Fri, 10 Apr 2026 15:34:23 +0100 Subject: [PATCH 2/3] fix: alt-text on submitted drawings --- src/render.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/render.rs b/src/render.rs index da98837..cb02a18 100644 --- a/src/render.rs +++ b/src/render.rs @@ -280,8 +280,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 +546,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 +558,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>")); } From a33be3be6c20430d20f8e26e974c4db2960fe2b6 Mon Sep 17 00:00:00 2001 From: lew Date: Fri, 10 Apr 2026 15:34:32 +0100 Subject: [PATCH 3/3] fix: error text is escaped --- src/render.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/render.rs b/src/render.rs index cb02a18..2e018ab 100644 --- a/src/render.rs +++ b/src/render.rs @@ -216,6 +216,7 @@ pub fn render_error_page(config: &Config, error: &str) -> String { } else { &config.style }; + let error = escape_html(error); format!( r#"