Skip to content

fix: filter NUL characters from chat records - #6743

Open
XIIRUAN wants to merge 1 commit into
1Panel-dev:v2from
XIIRUAN:fix/sanitize-nul-text-fields
Open

fix: filter NUL characters from chat records#6743
XIIRUAN wants to merge 1 commit into
1Panel-dev:v2from
XIIRUAN:fix/sanitize-nul-text-fields

Conversation

@XIIRUAN

@XIIRUAN XIIRUAN commented Aug 22, 2026

Copy link
Copy Markdown

What this PR does / why we need it?

PostgreSQL rejects native NUL (0x00) characters in text fields. Workflow output can reach ChatRecord.problem_text or ChatRecord.answer_text and cause the record write to fail.

Related to #6722.

Summary of your change

  • Remove NUL characters from chat record question and answer text before persistence.
  • Keep the fix scoped to ChatRecord instead of changing every model.
  • Add a regression test that exercises the real ChatRecord.save() sanitization path.

Validation

  • ChatRecordTestCase.test_save_removes_nul_characters
  • ruff check apps/application/models/application_chat.py apps/application/tests.py
  • Python compilation and diff checks

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact; no documentation change is required for this fix.

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.

1 participant