Skip to content

fix: sanitize PaddleOCR table HTML - #851

Draft
koi-lee wants to merge 1 commit into
Cinnamon:mainfrom
koi-lee:fix/paddleocr-table-html-sanitization
Draft

fix: sanitize PaddleOCR table HTML#851
koi-lee wants to merge 1 commit into
Cinnamon:mainfrom
koi-lee:fix/paddleocr-table-html-sanitization

Conversation

@koi-lee

@koi-lee koi-lee commented Jul 27, 2026

Copy link
Copy Markdown

Description

  • sanitize PaddleOCR table HTML before it is stored in Document.text and
    table_origin
  • preserve table structure and safe layout attributes such as rowspan and
    colspan
  • remove executable elements, event-handler attributes, unsafe URLs, and other
    non-table markup while preserving readable text
  • add regression coverage for direct sanitization and the document storage path

Fixes #834

Type of change

  • New features (non-breaking change).
  • Bug fix (non-breaking change).
  • Breaking change (fix or feature that would cause existing functionality not to work as expected).

Validation

  • pytest libs/kotaemon/tests/test_paddleocr_loader.py -q
    • 6 passed, 12 skipped because the optional PaddleOCR dependency is not installed
  • pre-commit run --files libs/kotaemon/kotaemon/loaders/paddleocr_loader/adapter.py libs/kotaemon/tests/test_paddleocr_loader.py
    • all hooks passed
  • pytest libs/kotaemon/tests -q
    • 113 passed, 20 skipped
    • 5 unrelated Milvus Lite tests failed because its local mmap manager did not initialize

Checklist

  • I have performed a self-review of my code.
  • I have added thorough tests if it is a core feature.
  • There is a reference to the original bug report and related work.
  • I have commented on my code, particularly in hard-to-understand areas.
  • The feature is well documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sanitize PaddleOCR table HTML before storage and UI render

1 participant