Skip to content

Commit

Permalink
Fix multiple file extensions for a single MIME type
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxocube committed Jan 6, 2025
1 parent fe935fb commit ba7077d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MediaFeeder/MediaFeeder/Providers/Youtube/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ internal async Task<string> 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<string>("MediaRoot");
path = Path.Join(path, "thumbnails", type, fileName);
Expand Down

0 comments on commit ba7077d

Please sign in to comment.