diff options
| author | Bond-009 <bond.009@outlook.com> | 2024-12-08 12:17:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-08 12:17:36 +0100 |
| commit | 6691380c04d0545ba5cb72597ec4331dcf6cafcf (patch) | |
| tree | ac2294c85191b55aac35aa192898e784a315f9af | |
| parent | f9aa93406bcf224556a6bd45ca9daac4e2ce3df4 (diff) | |
| parent | 43fff5799bd61c6ae3053444f75ca61b14b0a031 (diff) | |
Merge pull request #13076 from theguymadmax/tv-icon-image-fix
Determine tv image type by extension if content-type is unavailable
| -rw-r--r-- | MediaBrowser.Providers/Manager/ProviderManager.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index e43da1350..010e9c3b6 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -200,12 +200,20 @@ namespace MediaBrowser.Providers.Manager // TODO: Isolate this hack into the tvh plugin if (string.IsNullOrEmpty(contentType)) { + // Special case for imagecache if (url.Contains("/imagecache/", StringComparison.OrdinalIgnoreCase)) { contentType = MediaTypeNames.Image.Png; } else { + // Deduce content type from file extension + contentType = MimeTypes.GetMimeType(new Uri(url).GetLeftPart(UriPartial.Path)); + } + + // Throw if we still can't determine the content type + if (string.IsNullOrEmpty(contentType)) + { throw new HttpRequestException("Invalid image received: contentType not set.", null, response.StatusCode); } } |
