mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-05 18:38:17 -05:00
[PR #18576] [MERGED] fix(chats): fix chat search crash #47886
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/18576
Author: @Davixk
Created: 10/24/2025
Status: ✅ Merged
Merged: 11/6/2025
Merged by: @tjbck
Base:
dev← Head:fix/postgres-chats-search📝 Commits (2)
828155efix(chats): handle null bytes in PostgreSQL search62a5a2afix(chats): prevent null byte errors in PostgreSQL queries📊 Changes
1 file changed (+7 additions, -2 deletions)
View changed files
📝
backend/open_webui/models/chats.py(+7 -2)📄 Description
Changelog Entry
Description
This PR fixes a PostgreSQL-specific issue where chat searches would crash when encountering null bytes (
\u0000or\x00) in chat messages or titles. PostgreSQL does not allow null bytes in text fields, causing database errors during search operations. The fix adds proper filtering to exclude chats containing null bytes before attempting text extraction and comparison operations.Added
Changed
message->'content' IS NOT NULLbefore processingDeprecated
Removed
Fixed
Security
Breaking Changes
Additional Information
The fix specifically targets PostgreSQL databases where null bytes in JSON text fields cause errors. The solution:
\u0000in their JSON representation\x00(null bytes)This ensures the search operation only processes valid text content without null bytes, preventing database errors while maintaining search functionality.
Screenshots or Videos
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.