mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 10:04:44 +01:00
Use MediaTypeNames where possible (#13440)
This commit is contained in:
@@ -17,12 +17,12 @@ public static class ImageFormatExtensions
|
||||
public static string GetMimeType(this ImageFormat format)
|
||||
=> format switch
|
||||
{
|
||||
ImageFormat.Bmp => "image/bmp",
|
||||
ImageFormat.Bmp => MediaTypeNames.Image.Bmp,
|
||||
ImageFormat.Gif => MediaTypeNames.Image.Gif,
|
||||
ImageFormat.Jpg => MediaTypeNames.Image.Jpeg,
|
||||
ImageFormat.Png => "image/png",
|
||||
ImageFormat.Webp => "image/webp",
|
||||
ImageFormat.Svg => "image/svg+xml",
|
||||
ImageFormat.Png => MediaTypeNames.Image.Png,
|
||||
ImageFormat.Webp => MediaTypeNames.Image.Webp,
|
||||
ImageFormat.Svg => MediaTypeNames.Image.Svg,
|
||||
_ => throw new InvalidEnumArgumentException(nameof(format), (int)format, typeof(ImageFormat))
|
||||
};
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Mime;
|
||||
using Jellyfin.Extensions;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
@@ -144,7 +145,7 @@ namespace MediaBrowser.Model.Net
|
||||
new("video/x-matroska", ".mkv"),
|
||||
}.ToFrozenDictionary(pair => pair.Key, pair => pair.Value, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public static string GetMimeType(string path) => GetMimeType(path, "application/octet-stream");
|
||||
public static string GetMimeType(string path) => GetMimeType(path, MediaTypeNames.Application.Octet);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the MIME.
|
||||
|
||||
Reference in New Issue
Block a user