Find zip entries stored with backslash separators in pptx packages

Found while testing crates/pptx/src/opc.rs:77-82 (Package::open_within), lookup in Package::get via norm at :258

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
NetterSilver
2026-10-26 03:56:04 +00:00
co-authored by Claude Haiku 5.5
parent aaf6c1c38a
commit 939bd12832
+8 -1
View File
@@ -93,7 +93,7 @@ impl Package {
}
}
total = total.saturating_add(data.len() as u64);
parts.insert(name.to_ascii_lowercase(), (name, data));
parts.insert(norm(&name), (name, data));
}
Ok(Package { parts, ct_cache: std::sync::OnceLock::new() })
}
@@ -499,6 +499,13 @@ mod tests {
assert!(p.get("e").is_some());
}
#[test]
fn backslash_zip_entry_names_are_found() {
let z = zip_of(&[("PPT\\Slides\\Slide1.xml", 3)]);
let p = Package::open(&z).unwrap();
assert!(p.get("ppt/slides/slide1.xml").is_some());
}
#[test]
fn xml_bytes_applies_the_xml_limit() {
let z = zip_of(&[("small.xml", 10)]);