Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(pptx-to-svg): reject invalid line-end size buckets

hugohe37ea0ef4599db
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 47c97ab0..94ce7ef2 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -180,7 +180,9 @@ stealth. Checker and exporter preflight consume this same contract; other
marker shapes have no native mapping and block export instead of being silently
dropped. PPTX import likewise accepts only these five DrawingML line-end types
(plus `none`); an unknown source value stops import instead of being relabeled
-as a supported shape.
+as a supported shape. Optional DrawingML `w` and `len` values default to `med`;
+explicit values must be `sm`, `med`, or `lg`, and invalid source buckets stop
+import instead of being normalized to `med`.
---
diff --git a/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py
index 4e8c314f..77288795 100644
--- a/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py
+++ b/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py
@@ -196,8 +196,14 @@ def _build_arrow_marker(
w_b = end_elem.attrib.get("w", "med")
l_b = end_elem.attrib.get("len", "med")
- mw = SIZE_BUCKET.get(l_b, 2.5)
- mh = SIZE_BUCKET.get(w_b, 2.5)
+ for dimension, bucket in (("width", w_b), ("length", l_b)):
+ if bucket not in SIZE_BUCKET:
+ raise ValueError(
+ f"Unsupported DrawingML line-end {dimension} bucket: "
+ f"{bucket!r}"
+ )
+ mw = SIZE_BUCKET[l_b]
+ mh = SIZE_BUCKET[w_b]
seq[0] += 1
marker_id = f"{id_prefix}arrow{seq[0]}"
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index e23a8993..dd1e0faf 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2630,6 +2630,21 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
):
resolve_stroke(sp_pr, None)
+ def test_unknown_native_line_end_size_is_rejected_on_import(self):
+ for attribute, dimension in (("w", "width"), ("len", "length")):
+ with self.subTest(attribute=attribute):
+ sp_pr = ET.fromstring(f'''
+<p:spPr xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
+ xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
+ <a:ln><a:tailEnd type="triangle" {attribute}="xl"/></a:ln>
+</p:spPr>''')
+ with self.assertRaisesRegex(
+ ValueError,
+ f"Unsupported DrawingML line-end {dimension} bucket: "
+ "'xl'",
+ ):
+ resolve_stroke(sp_pr, None)
+
def test_imported_head_end_uses_supported_reversible_orientation(self):
drawingml_ns = (
'http://schemas.openxmlformats.org/drawingml/2006/main'