mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-23 01:05:19 +03:00
Use ArgumentException.ThrowIfNullOrEmpty
This commit is contained in:
@@ -140,10 +140,7 @@ namespace MediaBrowser.Model.Net
|
||||
[return: NotNullIfNotNull("defaultValue")]
|
||||
public static string? GetMimeType(string filename, string? defaultValue = null)
|
||||
{
|
||||
if (filename.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("String can't be empty.", nameof(filename));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(filename);
|
||||
|
||||
var ext = Path.GetExtension(filename);
|
||||
|
||||
@@ -168,10 +165,7 @@ namespace MediaBrowser.Model.Net
|
||||
|
||||
public static string? ToExtension(string mimeType)
|
||||
{
|
||||
if (mimeType.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("String can't be empty.", nameof(mimeType));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(mimeType);
|
||||
|
||||
// handle text/html; charset=UTF-8
|
||||
mimeType = mimeType.AsSpan().LeftPart(';').ToString();
|
||||
|
||||
Reference in New Issue
Block a user