summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2025-01-14 16:43:00 +1300
committerBen Bridle <ben@derelict.engineering>2025-01-14 19:10:21 +1300
commitb7983daa81e94de246ad8f209317f483e4206b89 (patch)
tree3ec705dac7a6115a7735569b879349436cd7a909 /src
parent384bac2d79ad137a29ff45913d63dd29d1104747 (diff)
downloadtoaster-b7983daa81e94de246ad8f209317f483e4206b89.zip
Sanitize the label of an embedded file
There was an issue where an apostrophe character in the label string would prematurely terminate the string.
Diffstat (limited to 'src')
-rw-r--r--src/generate_html.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/generate_html.rs b/src/generate_html.rs
index 129e2dd..62a33b6 100644
--- a/src/generate_html.rs
+++ b/src/generate_html.rs
@@ -158,6 +158,7 @@ pub fn document_to_html(document: &MarkdownDocument, page: &Page, website: &Webs
Some(stripped) => format!("{root}{stripped}"),
None => path.to_string(),
};
+ let label = sanitize_text(label);
match extension.to_lowercase().as_str() {
"jpg"|"jpeg"|"png"|"webp"|"gif"|"tiff" => html!(
"<figure><a href='{path}'><img src='{path}' alt='{label}' title='{label}'></a></figure>"),