[PR #21729] [CLOSED] fix: correct MIME type for .ts/.tsx/.jsx files to prevent upload rejection #26246

Closed
opened 2026-04-20 06:24:23 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/21729
Author: @stakeswky
Created: 2/22/2026
Status: Closed

Base: mainHead: fix/ts-file-mime-type-misdetection


📝 Commits (1)

  • 3d5cdaf fix: correct MIME type for .ts/.tsx/.jsx files to prevent upload rejection

📊 Changes

1 file changed (+28 additions, -0 deletions)

View changed files

📝 backend/open_webui/routers/files.py (+28 -0)

📄 Description

Fixes #21454

TypeScript (.ts) files were being rejected with "File type video/vnd.dlna.mpeg-tts is not supported for processing" because browsers misdetect them as MPEG Transport Stream video files.

This fix:

  1. Registers .ts/.tsx/.jsx extensions with correct text MIME types
  2. Adds MIME type correction logic using mimetypes.guess_type() to override misdetected types when the guessed type is text-based
  3. Preserves legitimate video/audio uploads (only overrides to text types)

Tested that .ts files now map to text/typescript and video/image files are unaffected.


🔄 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/21729 **Author:** [@stakeswky](https://github.com/stakeswky) **Created:** 2/22/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/ts-file-mime-type-misdetection` --- ### 📝 Commits (1) - [`3d5cdaf`](https://github.com/open-webui/open-webui/commit/3d5cdaf5856f2b8e492a9c9812063012c821f331) fix: correct MIME type for .ts/.tsx/.jsx files to prevent upload rejection ### 📊 Changes **1 file changed** (+28 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/files.py` (+28 -0) </details> ### 📄 Description Fixes #21454 TypeScript (.ts) files were being rejected with "File type video/vnd.dlna.mpeg-tts is not supported for processing" because browsers misdetect them as MPEG Transport Stream video files. This fix: 1. Registers .ts/.tsx/.jsx extensions with correct text MIME types 2. Adds MIME type correction logic using mimetypes.guess_type() to override misdetected types when the guessed type is text-based 3. Preserves legitimate video/audio uploads (only overrides to text types) Tested that .ts files now map to text/typescript and video/image files are unaffected. --- <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-04-20 06:24:23 -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#26246