Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
fix
Marc Seitz75eb16213153
diff --git a/ee/features/conversions/python/docx-sanitizer.py b/ee/features/conversions/python/docx-sanitizer.pyindex f91f5a00..cea9d773 100644--- a/ee/features/conversions/python/docx-sanitizer.py+++ b/ee/features/conversions/python/docx-sanitizer.py@@ -138,7 +138,21 @@ def sanitize_docx(input_path: str, output_path: str, mode: str = 'all') -> bool:with tempfile.TemporaryDirectory() as tmp:with zipfile.ZipFile(input_path, 'r') as z:- z.extractall(tmp)+ tmp_abs = os.path.abspath(tmp)+ for info in z.infolist():+ member_name = info.filename+ target_path = os.path.abspath(os.path.join(tmp, member_name))+ if not target_path.startswith(tmp_abs + os.sep):+ raise ValueError(f"Unsafe ZIP entry path: {member_name}")+ if info.is_dir():+ continue++ parent_dir = os.path.dirname(target_path)+ if parent_dir:+ os.makedirs(parent_dir, exist_ok=True)++ with z.open(info) as src, open(target_path, 'wb') as dst:+ shutil.copyfileobj(src, dst)doc_path = os.path.join(tmp, 'word', 'document.xml')if not os.path.exists(doc_path):