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): relax exported file permissions

hugohe3c319a2bc85a4
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py
index ce363c7b..95d9e609 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py
@@ -9,6 +9,8 @@ import os
import re
import posixpath
import shutil
+import stat
+import subprocess
import tempfile
import uuid
import zipfile
@@ -167,6 +169,47 @@ def _create_writable_work_dir(output_path: Path) -> Path:
)
+def _relax_output_permissions(output_path: Path) -> list[str]:
+ """Make exported files readable outside the sandbox owner where possible."""
+ warnings: list[str] = []
+
+ try:
+ current_mode = output_path.stat().st_mode
+ readable_mode = (
+ current_mode
+ | stat.S_IRUSR
+ | stat.S_IWUSR
+ | stat.S_IRGRP
+ | stat.S_IROTH
+ )
+ os.chmod(output_path, readable_mode)
+ except OSError as exc:
+ warnings.append(f"chmod skipped for {output_path}: {exc}")
+
+ if os.name != 'nt':
+ return warnings
+
+ # Windows ACLs can remain sandbox-only even when the file mode looks sane.
+ # Grant the built-in Users SID read access; the SID avoids localization
+ # issues on non-English Windows installations.
+ try:
+ result = subprocess.run(
+ ['icacls', str(output_path), '/grant', '*S-1-5-32-545:R'],
+ capture_output=True,
+ text=True,
+ check=False,
+ )
+ except OSError as exc:
+ warnings.append(f"icacls skipped for {output_path}: {exc}")
+ else:
+ if result.returncode != 0:
+ message = (result.stderr or result.stdout or '').strip()
+ details = f": {message}" if message else ''
+ warnings.append(f"icacls failed for {output_path}{details}")
+
+ return warnings
+
+
def _to_float(value: Any, default: float) -> float:
if value is None:
return default
@@ -1006,6 +1049,7 @@ def create_pptx_with_native_svg(
arcname = file_path.relative_to(extract_dir)
zf.write(file_path, arcname)
shutil.move(str(temp_output_path), str(output_path))
+ permission_warnings = _relax_output_permissions(output_path)
if conversion_trace_path and conversion_trace is not None:
conversion_trace_path.parent.mkdir(parents=True, exist_ok=True)
@@ -1022,6 +1066,8 @@ def create_pptx_with_native_svg(
if verbose:
print()
print(f"[Done] Saved: {output_path}")
+ for warning in permission_warnings:
+ print(f" [warn] {warning}")
if conversion_trace_path and conversion_trace is not None:
print(f" Trace: {conversion_trace_path}")
print(f" Succeeded: {success_count}, Failed: {len(svg_files) - success_count}")