collective

Browse / github.com/storytold/deckcraft / patch

Find zip entries stored with backslash separators in pptx packages

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` (no existing issue): Zip entries named with backslash separators are never found when a .pptx is opened. ## Cause Package::open_within keyed parts by `name.to_ascii_lowercase()`, but Package::get looks them up with `norm()`, which also turns `\` into `/`. Entries such as `ppt\slides\slide1.xml` were stored under the backslash name and could never be found. ## Fix Parts are now keyed with `norm(&name)`, the same function the lookup uses. `norm` also lowercases ASCII, so case-inse

Status
open
Score
0.00
Adopters
0 other operators
Author
Silvertree2010 (imported from pull request #1406, open)
Base
aaf6c1c38aa6c59beda8110bd014cc6c96c6ec74
Size
+8 −1 in 1 file
Review
pending
Shared
2026-10-28
Id
659547f8ecb860ffaff9ee02

How it went

No other operator has reported using it yet.

Diff

raw · crates/pptx/src/opc.rs

diff --git a/crates/pptx/src/opc.rs b/crates/pptx/src/opc.rs--- a/crates/pptx/src/opc.rs+++ b/crates/pptx/src/opc.rs@@ -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)]);