{"record":{"id":"f5410f9d13208609","repo":"opendatalab/MinerU","slug":"legacy-binary-ppt-files-are-not-supported-convert","errorCode":null,"errorMessage":"Legacy binary PPT files are not supported; convert the file to PPTX before parsing.","messagePattern":"Legacy binary PPT files are not supported; convert the file to PPTX before parsing\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mineru/model/pptx/package_normalizer.py","lineNumber":92,"sourceCode":"    (\n        b\"http://purl.oclc.org/ooxml/officeDocument/docPropsVTypes\",\n        b\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\",\n    ),\n    (\n        b\"http://purl.oclc.org/ooxml/officeDocument/oleObject\",\n        b\"http://schemas.openxmlformats.org/officeDocument/2006/oleObject\",\n    ),\n)\n\nKNOWN_NAMESPACE_DECLARATIONS = {\n    b\"w\": f'xmlns:w=\"{WORDPROCESSINGML_NS}\"'.encode(\"utf-8\"),\n}\n\n\ndef normalize_pptx_package(file_bytes: bytes) -> bytes:\n    \"\"\"在进入 python-pptx 前修复常见包级兼容问题，避免修复逻辑散落到形状解析阶段。\"\"\"\n    if file_bytes.startswith(LEGACY_PPT_MAGIC):\n        raise ValueError(\n            \"Legacy binary PPT files are not supported; convert the file to PPTX before parsing.\"\n        )\n\n    try:\n        with ZipFile(BytesIO(file_bytes)) as source:\n            loaded_members: list[tuple[ZipInfo, bytes]] = []\n            rewritten_members: list[tuple[ZipInfo, bytes]] = []\n            skipped_members: set[str] = set()\n            changed = False\n\n            for info in source.infolist():\n                member_data = _read_member_best_effort(source, info)\n                if member_data is None:\n                    skipped_members.add(info.filename)\n                    changed = True\n                    continue\n                loaded_members.append((info, member_data))\n","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/opendatalab/MinerU/blob/4fe4bde114a23ee5dd637eae99b767f4669bf58c/mineru/model/pptx/package_normalizer.py#L74-L110","documentation":"normalize_pptx_package rejects legacy binary PowerPoint files by magic number (the OLE2 compound-document signature, D0 CF 11 E0 ...). python-pptx can only read the OOXML zip format (.pptx), so .ppt files from PowerPoint 97-2003 fail immediately with a clear message instead of a confusing downstream parse error.","triggerScenarios":"Feeding a .ppt (or any OLE2 container like some .doc/.xls) file to the PPTX parsing pipeline; often happens because the file was renamed to .pptx without conversion.","commonSituations":"Users renaming instead of converting, scanned/exported documents saved in compatibility mode, or content-disposition pipelines that route by extension while the bytes are legacy format.","solutions":["Convert the file to real PPTX with LibreOffice: soffice --headless --convert-to pptx file.ppt.","Detect the format upstream by magic bytes, not extension, and route legacy files to a converter.","Re-export from the source application in Office 2007+ format."],"exampleFix":"# before\nresult = parse_pptx(open('deck.ppt','rb').read())\n\n# after\nsubprocess.run(['soffice','--headless','--convert-to','pptx','deck.ppt'])\nresult = parse_pptx(open('deck.pptx','rb').read())","handlingStrategy":"validation","validationCode":"LEGACY = bytes.fromhex('d0cf11e0a1b11ae1')\ndef is_legacy_ppt(data: bytes) -> bool:\n    return data[:8] == LEGACY","typeGuard":null,"tryCatchPattern":"try:\n    normalized = normalize_pptx_package(data)\nexcept ValueError as e:\n    if 'Legacy binary PPT' in str(e):\n        raise ValueError('convert with: soffice --headless --convert-to pptx <file>') from e\n    raise","preventionTips":["Sniff magic bytes at the upload boundary; never trust the extension.","Auto-convert legacy Office formats in an ingest queue before parsing.","Document accepted formats (OOXML only) in the API contract."],"tags":["pptx","file-format","document-parsing"],"backgroundTag":null,"analyzedSha":"4fe4bde114a23ee5dd637eae99b767f4669bf58c","analyzedAt":"2026-08-14T21:29:18.456Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}