Backport pull request #11699 from jellyfin/release-10.9.z

Use MediaType instead of ToString and add text/ as disallowed mimetypes

Original-merge: 46c748d8884d81c5a8ff2ecb5cc1caa9beb83356

Merged-by: joshuaboniface <joshua@boniface.me>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
cvium 2024-05-17 13:51:57 -04:00 committed by Joshua M. Boniface
parent 4ded042dde
commit 01946c6ef5

View File

@ -32,6 +32,8 @@ namespace Jellyfin.LiveTv.TunerHosts
{ {
private static readonly string[] _disallowedMimeTypes = private static readonly string[] _disallowedMimeTypes =
{ {
"text/plain",
"text/html",
"video/x-matroska", "video/x-matroska",
"video/mp4", "video/mp4",
"application/vnd.apple.mpegurl", "application/vnd.apple.mpegurl",
@ -118,7 +120,7 @@ namespace Jellyfin.LiveTv.TunerHosts
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
if (!_disallowedMimeTypes.Contains(response.Content.Headers.ContentType?.ToString(), StringComparison.OrdinalIgnoreCase)) if (!_disallowedMimeTypes.Contains(response.Content.Headers.ContentType?.MediaType, StringComparison.OrdinalIgnoreCase))
{ {
return new SharedHttpStream(mediaSource, tunerHost, streamId, FileSystem, _httpClientFactory, Logger, Config, _appHost, _streamHelper); return new SharedHttpStream(mediaSource, tunerHost, streamId, FileSystem, _httpClientFactory, Logger, Config, _appHost, _streamHelper);
} }