{"record":{"id":"e5036fea37fd3385","repo":"jumpserver/jumpserver","slug":"file-uploaded-name-is-not-a-valid-pptx-presentat","errorCode":null,"errorMessage":"File {uploaded.name} is not a valid PPTX presentation.","messagePattern":"File (.+?) is not a valid PPTX presentation\\.","errorType":"exception","errorClass":"FileExtractionError","httpStatus":400,"severity":"error","filePath":"apps/chat_ai/file_extractor.py","lineNumber":157,"sourceCode":"            raise FileExtractionError(f'File {uploaded.name} is not a valid DOCX document.')\n        return _xml_text(archive.read('word/document.xml'))\n\n\ndef _natural_key(value):\n    return [int(part) if part.isdigit() else part for part in re.split(r'(\\d+)', value)]\n\n\ndef _extract_pptx(uploaded):\n    with _open_office_archive(uploaded) as archive:\n        slides = sorted(\n            (\n                name for name in archive.namelist()\n                if re.fullmatch(r'ppt/slides/slide\\d+\\.xml', name)\n            ),\n            key=_natural_key,\n        )\n        if not slides:\n            raise FileExtractionError(f'File {uploaded.name} is not a valid PPTX presentation.')\n        return '\\n\\n'.join(\n            f'[Slide {index}]\\n{_xml_text(archive.read(name))}'\n            for index, name in enumerate(slides[:200], start=1)\n        )\n\n\ndef _extract_xlsx(uploaded, max_chars):\n    with _open_office_archive(uploaded):\n        pass\n    uploaded.seek(0)\n    workbook = load_workbook(uploaded, read_only=True, data_only=True)\n    try:\n        parts = []\n        length = 0\n        for sheet in workbook.worksheets:\n            parts.append(f'[Sheet: {sheet.title}]')\n            for row in sheet.iter_rows(values_only=True):\n                values = ['' if value is None else str(value) for value in row]","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/jumpserver/jumpserver/blob/6ec464fabd61b95912d539455a3a5f15f5c59fe0/apps/chat_ai/file_extractor.py#L139-L175","documentation":"_extract_pptx() finds no zip members matching ppt/slides/slideN.xml, meaning the archive contains no slides and is not a valid PPTX presentation.","triggerScenarios":"An empty presentation with zero slides, or a renamed zip that lacks the ppt/slides/ structure.","commonSituations":"Users uploading template files, empty decks, or renamed archives; also PPTX saved in unusual formats lacking standard slide parts.","solutions":["Ensure the presentation has at least one slide with content","Re-save from PowerPoint/Keynote as standard .pptx","Verify structure: unzip -l file.pptx | grep 'ppt/slides/'"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import zipfile, re\nwith zipfile.ZipFile(path) as z:\n    slides = [n for n in z.namelist() if re.fullmatch(r'ppt/slides/slide\\d+\\.xml', n)]\n    if not slides:\n        reject_upload('Not a valid PPTX (no slides)')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require at least one slide before accepting a PPTX","Validate zip structure client-side"],"tags":["pptx","invalid-format","file-parsing","chat-ai"],"backgroundTag":"invalid-office-document","analyzedSha":"6ec464fabd61b95912d539455a3a5f15f5c59fe0","analyzedAt":"2026-08-28T11:33:00.925Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}