mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-14 22:42:46 +00:00
Report rejected Krita internal DTDs clearly
This commit is contained in:
1 file changed
+4
-1
@@ -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)?;
|
||||
|
||||
Reference in new issue
Block a user