[PR #6941] [MERGED] Use MimeTypes package to determine MIME type #11203

Closed
opened 2026-02-07 06:34:13 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/6941
Author: @holahmeds
Created: 12/4/2021
Status: Merged
Merged: 12/5/2021
Merged by: @crobibero

Base: masterHead: mime-type


📝 Commits (5)

  • 6193fde Use MimeTypes package to determine MIME type
  • 40e05a7 Update documentation
  • 0e49102 Refactor MimeTypes.ToExtension()
  • fa6f651 Update unit test name
  • cf75f99 Update unit test name

📊 Changes

3 files changed (+218 additions, -99 deletions)

View changed files

📝 MediaBrowser.Model/MediaBrowser.Model.csproj (+4 -0)
📝 MediaBrowser.Model/Net/MimeTypes.cs (+50 -99)
tests/Jellyfin.Model.Tests/Net/MimeTypesTests.cs (+164 -0)

📄 Description

This simplifies the code since we don't have to keep large mappings of extensions and MIME types. The current method is also reportedly error prone (#494).

We still keep the ability to override the mappings for:

  • filling in entries not present in the package, for e.g. ".azw3"
  • picking preferred extensions, for e.g. MimeTypes provides ".conf" as a possible extionsion for "text/plain", and while that is correct, ".txt" would be preferrable
  • compatibility reasons

Issues
#494

Library: https://github.com/khellang/MimeTypes


🔄 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/jellyfin/jellyfin/pull/6941 **Author:** [@holahmeds](https://github.com/holahmeds) **Created:** 12/4/2021 **Status:** ✅ Merged **Merged:** 12/5/2021 **Merged by:** [@crobibero](https://github.com/crobibero) **Base:** `master` ← **Head:** `mime-type` --- ### 📝 Commits (5) - [`6193fde`](https://github.com/jellyfin/jellyfin/commit/6193fdea698ad4486140bc6a00a9547ab979c8f7) Use MimeTypes package to determine MIME type - [`40e05a7`](https://github.com/jellyfin/jellyfin/commit/40e05a7993599c43b58acb34f59ca5149dc76040) Update documentation - [`0e49102`](https://github.com/jellyfin/jellyfin/commit/0e491025aec8ef11acf86b189b5e16692fb8d4a6) Refactor MimeTypes.ToExtension() - [`fa6f651`](https://github.com/jellyfin/jellyfin/commit/fa6f6515a6874a5fca4267c50e6c597a2042ad96) Update unit test name - [`cf75f99`](https://github.com/jellyfin/jellyfin/commit/cf75f99f0e4d765cc7dfa928b3a508121f538db4) Update unit test name ### 📊 Changes **3 files changed** (+218 additions, -99 deletions) <details> <summary>View changed files</summary> 📝 `MediaBrowser.Model/MediaBrowser.Model.csproj` (+4 -0) 📝 `MediaBrowser.Model/Net/MimeTypes.cs` (+50 -99) ➕ `tests/Jellyfin.Model.Tests/Net/MimeTypesTests.cs` (+164 -0) </details> ### 📄 Description This simplifies the code since we don't have to keep large mappings of extensions and MIME types. The current method is also reportedly error prone (#494). We still keep the ability to override the mappings for: - filling in entries not present in the package, for e.g. ".azw3" - picking preferred extensions, for e.g. MimeTypes provides ".conf" as a possible extionsion for "text/plain", and while that is correct, ".txt" would be preferrable - compatibility reasons **Issues** #494 Library: https://github.com/khellang/MimeTypes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 06:34:13 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#11203