Report rejected Krita internal DTDs clearly

This commit is contained in:
Dylan M. Taylor committed 2026-11-13 05:53:40 -05:00
1 parent f5eeedf069
commit ba49bb3f02
1 file changed
+4 -1
+4 -1
View File
@@ -247,7 +247,10 @@ impl Image {
limits: craft_xml::Limits { max_input: MAX_MAINDOC, max_depth: MAX_XML_DEPTH, ..craft_xml::Limits::DEFAULT },
..craft_xml::Options::local().strict()
};
let root = options.parse(maindoc).map_err(|e| invalid(format!("maindoc.xml: {e}")))?;
let root = options.parse(maindoc).map_err(|e| match e {
craft_xml::Error::Doctype => invalid("maindoc.xml: an internal DTD is not accepted"),
other => invalid(format!("maindoc.xml: {other}")),
})?;
let image = root.child("IMAGE").ok_or_else(|| invalid("maindoc.xml has no IMAGE"))?;
let side = |a: &str| -> Result<u32> {
let v = number(image, a, 0.0)?;