address review: check the web page size after each chart and before returning it

This commit is contained in:
Dylan M. Taylor
2026-11-04 01:20:55 +00:00
parent 52e64c9626
commit 7e967f6489
+6
View File
@@ -790,11 +790,17 @@ pub fn to_html(wb: &Workbook, sheet: usize) -> Result<String> {
for ch in &sh.charts {
if let Some(svg) = crate::chart_svg::chart_svg(wb, sheet, ch, &place(&ch.anchor)) {
out.push_str(&svg);
if out.len() > HTML_EXPORT_MAX_BYTES {
return Err(html_too_big());
}
}
}
out.push_str("</div>");
}
out.push_str("</body></html>");
if out.len() > HTML_EXPORT_MAX_BYTES {
return Err(html_too_big());
}
Ok(out)
}