From ba7077db4de989880c5ba1cd92af149f7007434b Mon Sep 17 00:00:00 2001 From: Foxocube Date: Mon, 6 Jan 2025 20:46:23 +0000 Subject: [PATCH] Fix multiple file extensions for a single MIME type --- MediaFeeder/MediaFeeder/Providers/Youtube/Utils.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MediaFeeder/MediaFeeder/Providers/Youtube/Utils.cs b/MediaFeeder/MediaFeeder/Providers/Youtube/Utils.cs index 923343c..810b9b0 100644 --- a/MediaFeeder/MediaFeeder/Providers/Youtube/Utils.cs +++ b/MediaFeeder/MediaFeeder/Providers/Youtube/Utils.cs @@ -17,10 +17,10 @@ internal async Task LoadUrlThumbnail(string itemId, string type, string var request = await httpClient.GetAsync(url, cancellationToken); request.EnsureSuccessStatusCode(); - var ext = new FileExtensionContentTypeProvider().Mappings - .SingleOrDefault(g => g.Value == request.Content.Headers.ContentType?.MediaType) - .Key ?? ".png"; - var fileName = $"{itemId}{ext}"; + var ext = new FileExtensionContentTypeProvider().Mappings + .FirstOrDefault(g => g.Value == request.Content.Headers.ContentType?.MediaType) + .Key ?? ".png"; + var fileName = $"{itemId}{ext}"; var path = configuration.GetValue("MediaRoot"); path = Path.Join(path, "thumbnails", type, fileName);