mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 18:14:42 +01:00
Use ArgumentException.ThrowIfNullOrEmpty
This commit is contained in:
@@ -29,12 +29,7 @@ namespace MediaBrowser.Model.Cryptography
|
||||
|
||||
public PasswordHash(string id, byte[] hash, byte[] salt, Dictionary<string, string> parameters)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(id);
|
||||
|
||||
if (id.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("String can't be empty", nameof(id));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(id);
|
||||
|
||||
Id = id;
|
||||
_hash = hash;
|
||||
|
||||
@@ -9,10 +9,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
public SearchCriteria(string search)
|
||||
{
|
||||
if (search.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("String can't be empty.", nameof(search));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(search);
|
||||
|
||||
SearchType = SearchType.Unknown;
|
||||
|
||||
|
||||
@@ -1496,10 +1496,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
throw new ArgumentException("ItemId is required");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(options.DeviceId))
|
||||
{
|
||||
throw new ArgumentException("DeviceId is required");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(options.DeviceId);
|
||||
|
||||
if (options.Profile is null)
|
||||
{
|
||||
|
||||
@@ -620,10 +620,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public string ToUrl(string baseUrl, string accessToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(baseUrl))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(baseUrl));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(baseUrl);
|
||||
|
||||
var list = new List<string>();
|
||||
foreach (NameValuePair pair in BuildParams(this, accessToken))
|
||||
@@ -664,10 +661,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
private string GetUrl(string baseUrl, string queryString)
|
||||
{
|
||||
if (string.IsNullOrEmpty(baseUrl))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(baseUrl));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(baseUrl);
|
||||
|
||||
string extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container;
|
||||
|
||||
|
||||
@@ -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