mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[PR #15035] [MERGED] fix: Resolve UnicodeEncodeError for non-ASCII usernames in forwarded headers #46742
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/15035
Author: @decent-engineer-decent-datascientist
Created: 6/16/2025
Status: ✅ Merged
Merged: 6/17/2025
Merged by: @tjbck
Base:
dev← Head:dev📝 Commits (2)
f7920dfFix non-ascii error issue on ENABLE_FORWARD_USER_INFO_HEADERS8a63a60Fix typo on ollama patch📊 Changes
5 files changed (+89 additions, -85 deletions)
View changed files
📝
backend/open_webui/retrieval/utils.py(+13 -12)📝
backend/open_webui/routers/audio.py(+5 -4)📝
backend/open_webui/routers/images.py(+5 -4)📝
backend/open_webui/routers/ollama.py(+37 -36)📝
backend/open_webui/routers/openai.py(+29 -29)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.urllibis a standard Python library.)UnicodeEncodeErrorduring file uploads and other operations where headers are forwarded.)Changelog Entry
Description
This pull request fixes a
UnicodeEncodeErrorthat occurs when theENABLE_FORWARD_USER_INFO_HEADERSsetting is enabled for users with non-ASCII characters (e.g., Korean, Cyrillic) in their profile information.The root cause was that user details were being placed directly into HTTP headers, which do not support non-Latin-1 characters. This change URL-encodes the values of the
X-OpenWebUI-User-*headers to ensure they are safely transmitted, preventing the application from crashing during operations like file uploads or model interactions.Added
Changed
X-OpenWebUI-User-Name,X-OpenWebUI-User-Id,X-OpenWebUI-User-Email,X-OpenWebUI-User-Role) now have their values URL-encoded for safe HTTP transport.Deprecated
Removed
Fixed
UnicodeEncodeError: 'latin-1' codec can't encode characterswhenENABLE_FORWARD_USER_INFO_HEADERSis active for users with non-ASCII profile information.Security
Breaking Changes
Additional Information
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.