[PR #13441] [CLOSED] Fallback to URL extension for image type when content header is invalid #13578

Closed
opened 2026-02-07 07:15:29 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/13441
Author: @theguymadmax
Created: 1/26/2025
Status: Closed

Base: masterHead: bin-image-fix


📝 Commits (1)

  • 5915fd7 Fallback to URL extension for image type when content header is invalid

📊 Changes

1 file changed (+14 additions, -1 deletions)

View changed files

📝 MediaBrowser.Providers/Manager/ItemImageProvider.cs (+14 -1)

📄 Description

Changes

This PR modifies the DownloadImage method in ItemImageProvider to handle cases where the image's content header does not indicate a valid image type. In these cases, the extension of the image URL is used to infer the content type. If the content type still cannot be determined by either the content header or the URL extension, it defaults to image/jpeg. This ensures that images are correctly downloaded with the appropriate extension and prevents them from being mistakenly downloaded as binary files.

Issues

#12593

🔄 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/13441 **Author:** [@theguymadmax](https://github.com/theguymadmax) **Created:** 1/26/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `bin-image-fix` --- ### 📝 Commits (1) - [`5915fd7`](https://github.com/jellyfin/jellyfin/commit/5915fd7c9a58f80a5c6e935c67c49ac90e8c2a46) Fallback to URL extension for image type when content header is invalid ### 📊 Changes **1 file changed** (+14 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `MediaBrowser.Providers/Manager/ItemImageProvider.cs` (+14 -1) </details> ### 📄 Description <!-- Ensure your title is short, descriptive, and in the imperative mood (Fix X, Change Y, instead of Fixed X, Changed Y). For a good inspiration of what to write in commit messages and PRs please review https://chris.beams.io/posts/git-commit/ and our documentation. --> **Changes** <!-- Describe your changes here in 1-5 sentences. --> This PR modifies the `DownloadImage` method in` ItemImageProvider` to handle cases where the image's content header does not indicate a valid image type. In these cases, the extension of the image URL is used to infer the content type. If the content type still cannot be determined by either the content header or the URL extension, it defaults to `image/jpeg`. This ensures that images are correctly downloaded with the appropriate extension and prevents them from being mistakenly downloaded as binary files. **Issues** <!-- Tag any issues that this PR solves here. ex. Fixes # -->#12593 --- <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 07:15:29 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#13578