markitdown icon indicating copy to clipboard operation
markitdown copied to clipboard

Fix: guard against None text in PptxConverter

Open Jah-yee opened this issue 7 months ago • 1 comments

Good day

Fix: guard against None text in PptxConverter

Issue: microsoft/markitdown#1808

When python-pptx returns None for shape.text or notes_frame.text (e.g. third-party generators, SmartArt elements, malformed runs without text content), the string concatenation operator (+) threw TypeError: can only concatenate str (not NoneType) to str and crashed the entire PPTX conversion. One malformed shape would fail the whole file.

Changes (3 lines, 1 file):

  • L165: shape.text.lstrip() → (shape.text or "").lstrip()
  • L167: shape.text + "\n" → (shape.text or "") + "\n"
  • L197: notes_frame.text → (notes_frame.text or "")

Testing:

  • Syntax validation passed
  • Logic is a minimal, targeted guard — no behavior change for normal files
  • Follows existing or "" null-coalescing pattern already present in the same file (line 194)

Thank you for your work on this project. I hope this small fix is helpful. Please let me know if there's anything to adjust.

Warmly, RoomWithOutRoof

Jah-yee avatar Apr 23 '26 08:04 Jah-yee

Hi maintainers! This is a very small 3-line safety fix (guard against None text in PptxConverter). The PR has been waiting for a while with no reviews. Could someone take a look? Happy to make any adjustments. Thanks!

Jah-yee avatar Apr 24 '26 10:04 Jah-yee

👋 Hi! Just checking in on this PR — it has been open for 13 days without any reviews. Is there anything I can help with to move this forward? Happy to address any feedback. Thanks!

Jah-yee avatar May 06 '26 19:05 Jah-yee

👋 Just a gentle follow-up — this PR is now at the 14-day mark with no reviews. I completely understand if this isn't a priority right now. If there's anything I can do to make this easier to review (more tests, different approach, etc.), please let me know. Happy to close if it's not aligned with the project direction.

Jah-yee avatar May 06 '26 21:05 Jah-yee