mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-17 00:04:18 +00:00
fix(xfa): initialize form-data parsing options completely
This commit is contained in:
1 file changed
+2
-2
@@ -192,7 +192,7 @@ pub fn parse_data_file(text: &str, expect_root: Option<&str>) -> Result<Vec<Impo
|
||||
if crate::xml_nesting_depth(text) > MAX_IMPORT_DEPTH {
|
||||
return Err(XfaError::TooLarge(format!("the data file nests more than {MAX_IMPORT_DEPTH} levels deep")));
|
||||
}
|
||||
let opts = crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() };
|
||||
let opts = crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES };
|
||||
let parsed = crate::xml::Document::parse_with_options(text, opts).map_err(|e| XfaError::Malformed(format!("the data file is not XML: {e}")))?;
|
||||
let root = parsed.root_element();
|
||||
let local = root.tag_name().name();
|
||||
@@ -304,7 +304,7 @@ pub fn export_data(doc: &Document, xdp: bool, pdf_name: &str) -> Result<String,
|
||||
/// data element), each with the namespaces it uses declared on it. `Ok(None)`: no datasets
|
||||
/// element; `Err`: the text can't be read.
|
||||
fn datasets_markup(text: &str) -> Result<Option<(String, String)>, ()> {
|
||||
let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES, ..Default::default() };
|
||||
let opts = || crate::xml::ParsingOptions { allow_dtd: false, nodes_limit: MAX_NODES };
|
||||
if crate::xml_nesting_depth(text) > crate::MAX_XML_DEPTH {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user