mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-17 06:23:03 +03:00
Merge remote-tracking branch 'upstream/api-migration' into api-channel
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@@ -71,7 +71,7 @@ namespace Jellyfin.Api.Helpers
|
||||
}
|
||||
|
||||
return null;
|
||||
}).Where(i => i.HasValue).Select(i => i.Value).ToArray();
|
||||
}).Where(i => i.HasValue).Select(i => i!.Value).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -85,5 +85,24 @@ namespace Jellyfin.Api.Helpers
|
||||
? Array.Empty<ItemFilter>()
|
||||
: filters.Split(',').Select(v => Enum.Parse<ItemFilter>(v, true));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Splits a string at a separating character into an array of substrings.
|
||||
/// </summary>
|
||||
/// <param name="value">The string to split.</param>
|
||||
/// <param name="separator">The char that separates the substrings.</param>
|
||||
/// <param name="removeEmpty">Option to remove empty substrings from the array.</param>
|
||||
/// <returns>An array of the substrings.</returns>
|
||||
internal static string[] Split(string value, char separator, bool removeEmpty)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
|
||||
return removeEmpty
|
||||
? value.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries)
|
||||
: value.Split(separator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user