mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-15 21:43:03 +03:00
Remove incorrect mime type image/jpg
This commit is contained in:
27
MediaBrowser.Model/Drawing/ImageFormatExtensions.cs
Normal file
27
MediaBrowser.Model/Drawing/ImageFormatExtensions.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.ComponentModel;
|
||||
using System.Net.Mime;
|
||||
|
||||
namespace MediaBrowser.Model.Drawing;
|
||||
|
||||
/// <summary>
|
||||
/// Extension class for the <see cref="ImageFormat" /> enum.
|
||||
/// </summary>
|
||||
public static class ImageFormatExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the correct mime type for this <see cref="ImageFormat" />.
|
||||
/// </summary>
|
||||
/// <param name="format">This <see cref="ImageFormat" />.</param>
|
||||
/// <exception cref="InvalidEnumArgumentException">The <paramref name="format"/> is an invalid enumeration value.</exception>
|
||||
/// <returns>The correct mime type for this <see cref="ImageFormat" />.</returns>
|
||||
public static string GetMimeType(this ImageFormat format)
|
||||
=> format switch
|
||||
{
|
||||
ImageFormat.Bmp => "image/bmp",
|
||||
ImageFormat.Gif => MediaTypeNames.Image.Gif,
|
||||
ImageFormat.Jpg => MediaTypeNames.Image.Jpeg,
|
||||
ImageFormat.Png => "image/png",
|
||||
ImageFormat.Webp => "image/webp",
|
||||
_ => throw new InvalidEnumArgumentException(nameof(format), (int)format, typeof(ImageFormat))
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user