Fix PPTX shape sorting treating top-zero as missing - #2408
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The equivalent OCR converter remains affected, and regression coverage is missing.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes PPTX reading order for shapes positioned at coordinate zero.
Changes:
- Uses explicit
Nonechecks for group and slide shape sorting.
File summaries
| File | Description |
|---|---|
_pptx_converter.py |
Preserves zero-valued shape coordinates during sorting. |
Review details
Suppressed comments (1)
packages/markitdown/src/markitdown/converters/_pptx_converter.py:203
- Please add a regression test that orders a zero-positioned shape against a negative-positioned shape (and covers the grouped-shape path). Comparing zero only with positive coordinates would pass under the old
-infbehavior and would not protect this fix; the repository already has PPTX regression coverage inpackages/markitdown/tests.
float("-inf") if x.top is None else x.top,
float("-inf") if x.left is None else x.left,
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+192
to
+193
| float("-inf") if x.top is None else x.top, | ||
| float("-inf") if x.left is None else x.left, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_pptx_converter.pyused if notx.top / x.leftfor sort keys, so shapes at position0were treated as missing and sorted as-inf, corrupting slide reading order.This change checks
is Noneinstead to preserve correct order for zero-positioned shapes.