[PR #20664] [CLOSED] fix: await uploadFileHandler and preserve error message #113034

Closed
opened 2026-05-18 13:17:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/20664
Author: @lorenzophys
Created: 1/14/2026
Status: Closed

Base: devHead: fix-await-filehandler


📝 Commits (2)

  • 6d8db4c fix: await uploadFileHandler and preserve error message
  • ddb4e84 log the httpexception

📊 Changes

2 files changed (+6 additions, -2 deletions)

View changed files

📝 backend/open_webui/routers/files.py (+4 -0)
📝 src/lib/components/chat/MessageInput.svelte (+2 -2)

📄 Description

Changelog Entry

Description

When uploading files not allowed by the RAG_ALLOWED_FILE_EXTENSIONS variable, there should be a red error message in the top-right corner of the screen explaining why the upload has failed. Instead OpenWebUI fails silently, displaying only a generic violation of the CSP in the JS console.

I found that the error message should already be printed, but uploadFileHandler is not awaited, so the message doesn't actually shows. Moreover, the default error message is too generic and the user will only see Error uploading file, so I added an except block to propagate a more specific error.

Fixed

  • uploadFileHandler is now awaited
  • Show a better error message when upload fails due to CSP

Additional Information

Issue I opened: https://github.com/open-webui/open-webui/issues/20662

TEST: Screenshots or Videos

I performed a manual test:

Built the image with the changes:

docker build -t oui:await-fix .

Ran a container

docker run -d \
  -p 3000:8080 \
  -e RAG_ALLOWED_FILE_EXTENSIONS="pdf,txt,docx" \
  -v open-webui:/app/backend/data \
  --name open-webui-test \
  oui:await-fix

Clicked the plus icon, then the attach icon, selected a zip file and this is what shows:

Screenshot 2026-01-14 at 13 42 40

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.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/20664 **Author:** [@lorenzophys](https://github.com/lorenzophys) **Created:** 1/14/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix-await-filehandler` --- ### 📝 Commits (2) - [`6d8db4c`](https://github.com/open-webui/open-webui/commit/6d8db4ca3d58e7e885559638365adae2ba65ea3c) fix: await uploadFileHandler and preserve error message - [`ddb4e84`](https://github.com/open-webui/open-webui/commit/ddb4e845414cf19b6bb8c1064a8f6f080aee4ba8) log the httpexception ### 📊 Changes **2 files changed** (+6 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/files.py` (+4 -0) 📝 `src/lib/components/chat/MessageInput.svelte` (+2 -2) </details> ### 📄 Description # Changelog Entry ### Description When uploading files not allowed by the `RAG_ALLOWED_FILE_EXTENSIONS` variable, there should be a red error message in the top-right corner of the screen explaining why the upload has failed. Instead OpenWebUI fails silently, displaying only a generic violation of the CSP in the JS console. I found that the error message should already be printed, but `uploadFileHandler` is not awaited, so the message doesn't actually shows. Moreover, the default error message is too generic and the user will only see `Error uploading file`, so I added an `except` block to propagate a more specific error. ### Fixed - `uploadFileHandler` is now awaited - Show a better error message when upload fails due to CSP --- ### Additional Information Issue I opened: https://github.com/open-webui/open-webui/issues/20662 ### TEST: Screenshots or Videos I performed a manual test: Built the image with the changes: ```bash docker build -t oui:await-fix . ``` Ran a container ```bash docker run -d \ -p 3000:8080 \ -e RAG_ALLOWED_FILE_EXTENSIONS="pdf,txt,docx" \ -v open-webui:/app/backend/data \ --name open-webui-test \ oui:await-fix ``` Clicked the plus icon, then the attach icon, selected a zip file and this is what shows: <img width="377" height="62" alt="Screenshot 2026-01-14 at 13 42 40" src="https://github.com/user-attachments/assets/ba1adcab-2c37-47be-bc97-e135c1191d5c" /> ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-18 13:17:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#113034